Hi, I have to write tic tac toe for a class and I have never even written a loop. Obviously I haven't put my study time in, but that's besides the point. Can someone please explain to me why this keeps repeating
"Please make a selection:" even after I enter 1 or 2? It's probably obvious.
Code:#include <iostream> #include <string> using namespace std; void printMenu(); float makeSel(); int main() { do{ printMenu(); makeSel(); //game goes here cout<<"game"<<endl; }while (makeSel()!=2); return 0; } void printMenu() { cout<<"Welcome to Tic-Tac-Toe!"<<endl<<"Three in a row wins!"<<endl; cout<<" 1).Play a game."<<endl<<" 2).Quit"<<endl; } float makeSel() { float sel; do{ cout<<"Please Make a Selection: "; cin>>sel; } while(sel!=1 ||sel!=2); return sel; }