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');

Edited by happygeek: fixed formatting

9 Years
Discussion Span
Last Post by stilllearning

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.