I made a string of States and under it a corresponding string of Capitals. I have it so it randomly pick a state and ask for capital or pick a capital and ask for state. Sometimes it repeats and I am trying to have it make a list of the states it has selected already. then check the next time it picks if its already been picked. if it has, I want it to pick another one.
I have this:
std::string State[]{...}
std::string Capital[]{...}
const int iState = sizeof (State) / sizeof (std::string);
const int iCapital = sizeof (Capital) / sizeof (std::string);
std::vector<std::string> StatesPicked;
std::vector<std::string> CapitalsPicked;
...
int iStateSelected = rand() % iState;
//sends the last state picked to the end of the StatesPicked
StatesPicked.push_back(State[iStateSelected]);
std::vector<int>::iterator StateList;
int N = 0;
for( StateList = StatesPicked.begin() + N; StateList < StatesPicked.end(); N++)
my code is all split up. I am having a "no operator "=" matches these operands" for the = and the < in the for statement. I'm sure you can figure it out. but i have it randomly select a state. put it into the back of the vector StatesPicked. then im trying to add it to StateList. then test the new Randomly selected word with the olds. if they match then select a new one. Also need help going through the whole vector the check. if there is a different/ easier method i am open for anything that will help
Please help me! and p.s i am kinda intermediate/ beginner with C++