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
trouble getting goAgain loop to work
trouble getting goAgain loop to work
Mar 27, 2013 at 6:40am UTC
hitchhikes4mail
(2)
I've been practicing creating do while loops to keep a program open.
I've seen a method used that prompts the user to input either y/n, but I can only get it to loop with numbers and not letters.
would appreciate any help ty.
#include<iostream>
using namespace std;
int main ()
{
int goAgain;
do {
cout<< "would you like to go again? y/n \n";
cin>> goAgain;
}while (goAgain == 'y');
return 0;
}
Mar 27, 2013 at 6:58am UTC
Fransje
(435)
Change
int
goAgain;
to
char
goAgain;
.
Mar 27, 2013 at 7:26am UTC
hitchhikes4mail
(2)
thank you
Topic archived. No new replies allowed.