This is a basic c++ console application that I am working on, just to test things out before o do something a little bit more advanced. I would like to know how I would find out if the user input is part of my String array with an if statement here is the code so far...
#include <iostream>
#include <string>
using namespace std;
int main(){
string array[] = {"1","2","3"};
for(;;){
cout << "Enter a random number";
int randNum = 0;
cin >> randNum;
if(/* randNum is part of the array */)
{
//do something
}
else{
//do something
}
}
return 0;
}