| | |
c++ help
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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
Views: 475 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





