Search:
Forum
Beginners
Using a function of type bool as a condi
[try Beta version]
Not logged in
register
log in
user name:
password:
remember me
forgot your password?
or sign in using:
try again
cancel
forgot your password?
Using a function of type bool as a condition for while loop
Mar 5, 2019 at 4:44am
Mar 5, 2019 at 4:44am UTC
kenken
(16)
I get error (C++ forbids comparison between pointer and integer) when i used a bool function as the condition in a while loop. Can someone please help me.
The code looks something like this.
bool again()
{
char answer;
cout << "Enter y to try again: ";
cin >> answer;
return (answer == 'Y' || answer == 'y');
}
do
{
}while(again==true) // This line of code is the problem.
Thanks in advance!
Mar 5, 2019 at 4:48am
Mar 5, 2019 at 4:48am UTC
salem c
(3708)
Like this.
1
2
do
{ }
while
( again() )
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs