return values of boolean functions

Jul 2, 2008 at 2:53am
i get an error in this block when i compile

while (Repeat == true);

return 0;
}
here is the function

bool Repeat(char again)
{
cout << "Do you need more help?" << endl;
cin >> again

if (again == 'y'){
return true;
}
else {
return false;
}
}

i want to find some way of returning the value of this to main to use in the do while loop.
but i get this error:

'Repeat' was not declared in this scope.

i included the header file, so that's not it.

any help would be greatly appreciated
Last edited on Jul 2, 2008 at 2:55am
Jul 2, 2008 at 3:01am
:)

1st:
Repeat funcion must be defined before it's using;

and your code can change to:
while(Repeat()){....}

Last edited on Jul 2, 2008 at 3:15am
Jul 2, 2008 at 5:51am
You can change the function a bit too
1
2
3
4
5
6
7
8
9
10
11
bool Repeat()
{
   char again;
   cout << "Do you need more help?" << endl;
   cin >> again; // notice semi-colon here too

   if(again == 'y')
      return true;

   return false;
}
Topic archived. No new replies allowed.