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');
}
Last edited by justinlake888; Oct 6th, 2008 at 2:05 am.
How do you get a program to work without using a global variable? I looked up a global variable and I just thought it meant when the variable is outside of int ().
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.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.