| | |
c++ help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 8
Reputation:
Solved Threads: 0
I am working on a code and I want it to ask if I want it to enter another number... when I hit "y OR Y" it repeats but the code. I don't know how to make it output "bye" when I type "N or n". Can someone please help me? Thanks.
this is part of the code that I have for Y/y which is working but I need to output something for N/n.
bool Continue()
{
char decision;
cout<<"\nDo you want to enter another number?(Y/N):";
cin >> decision;
return (decision=='y')||(decision=='Y');
}
this is part of the code that I have for Y/y which is working but I need to output something for N/n.
bool Continue()
{
char decision;
cout<<"\nDo you want to enter another number?(Y/N):";
cin >> decision;
return (decision=='y')||(decision=='Y');
}
Last edited by justinlake888; Oct 6th, 2008 at 2:05 am.
C++ Syntax (Toggle Plain Text)
if(!Continue()) { cout << "bye" <<endl; }
is this what you want?
thanks
-chandra
-chandra
•
•
Join Date: Oct 2007
Posts: 305
Reputation:
Solved Threads: 43
A global variable is a variable that you can access from every scope. That is, you would normally define it outside any function, and all of your functions would have access to it
Local variables are defined it inside your function, and are passed as an argument to any other functions that might need access to them.
Local variables are defined it inside your function, and are passed as an argument to any other functions that might need access to them.
![]() |
Other Threads in the C++ Forum
- Previous Thread: storing a directory location
- Next Thread: Need help in Overloading << and >> operator
| Thread Tools | Search this Thread |
api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting string strings studio temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





