Dec 15, 2011 at 6:36pm UTC
Hi im quite a programming noob :) could anyone tell me why this for loop is asking for another semi-colon? Just say if yous need more code :)
string ChooseCategorySelectRandomWord(){
int userChoice = 0;
cout << "Please choose a catagory" << endl << "1.Sports" << endl << "2.Food" << endl << "3.Countries" << endl << "4.Movies" << endl << "5.Games" << endl; // This asks and displays options for the user
cin >> userChoice;
if( between(userChoice, 1, 5) ){
string filename = wordFiles[userChoice-1];
ifstream in (filename);
string wordToGuess;
srand ( time(NULL) );
int r = rand() %20;
do
in>> stringToGuess;
while ( --r >= 0 );
cout << stringToGuess << endl;
return stringToGuess;
} else {
for (!between(userChoice, 1, 5)) {
cout << " Enter A Number Between 1 And 5" << endl;
userChoice = 0;
cin >> userChoice;
Dec 15, 2011 at 6:49pm UTC
for (!between(userChoice, 1, 5)) the second bracket has an error message saying expected a ;
Dec 15, 2011 at 6:50pm UTC
The do-while loop?
Alright the syntax for
do-while loops looks like this
1 2 3 4 5 6
do
{
// Do Some Stuff
}while (expression );
You may want to look over the do while loop you have. Your missing brackets. If you put that in, I think it should fix your error.
Last edited on Dec 15, 2011 at 6:52pm UTC
Dec 15, 2011 at 6:52pm UTC
cheers i added that but it is still saying expecting ; and nah the for.