cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Using a function of type bool as a condi
Using a function of type bool as a condition for while loop
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 UTC
salem c
(3700)
Like this.
1
2
do
{ }
while
( again() )
Topic archived. No new replies allowed.