My new programm......having problems.
So I started this new program and I can't seem to get past the first step.
Code:
#include <iostream>
using namespace std;
int main()
{
char Menu, Start, Recall, Exit,choice;
cout <<"Hello, how are we today?" <<endl;
cout <<"|===================|" <<endl;
cout <<"| (M)enu |" <<endl;
cout <<"| (S)tart |" <<endl;
cout <<"| (R)ecall |" <<endl;
cout <<"| (E)xit |" <<endl;
cout <<"|______________________|" <<endl;
cout <<"Please choose a destination" <<endl;
cin >>choice;
if (choice == Menu)
{
cout <<"You are in menu now!" <<endl;
}
system("pause");
return 0;
}
The menu choice option won't work. Any ideas?
Re: My new programm......having problems.
Quote:
Originally posted by RealityFusion So I started this new program and I can't seem to get past the first step.
Code:
#include <iostream>
using namespace std;
int main()
{
char Menu, Start, Recall, Exit,choice;
const char Menu = 'M';
const char Start = 'S';
const char Recall = 'R';
const char Exit = 'E';
char choice;
cout <<"Hello, how are we today?" <<endl;
cout <<"|===================|" <<endl;
cout <<"| (M)enu |" <<endl;
cout <<"| (S)tart |" <<endl;
cout <<"| (R)ecall |" <<endl;
cout <<"| (E)xit |" <<endl;
cout <<"|______________________|" <<endl;
cout <<"Please choose a destination" <<endl;
cin >>choice;
if (choice == Menu)
{
cout <<"You are in menu now!" <<endl;
}
system("pause");
return 0;
}
The menu choice option won't work. Any ideas?
If you make a comparison (choice == Menu) you have to have declared both variables before. In your program you declared choice when typing it in, but you never declared what Menu is.
I added const in front of the variables, since I'm guessing that they won't be changed...