continuing program until instructed by user
Oct 11, 2014 at 5:32pm UTC
.....
Last edited on Oct 11, 2014 at 7:50pm UTC
Oct 11, 2014 at 5:37pm UTC
you can use while like
cout<<enter an input;
cin >>input
while(input!="x"){
cout<<enter an input;
}
Oct 11, 2014 at 5:42pm UTC
....
Last edited on Oct 11, 2014 at 7:50pm UTC
Oct 11, 2014 at 6:07pm UTC
try this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
using namespace std;
int main()
{
char input;
cout << "enter a char from A to Z: " ;
cin >> input;
if (input >= 'A' || input <= 'Z' )
cout << "\nthe letter is " << input; // \n is a newline, down one
return 0; // return value to main, declared as type integer
}
Last edited on Oct 11, 2014 at 6:17pm UTC
Oct 11, 2014 at 6:21pm UTC
.....
Last edited on Oct 11, 2014 at 7:50pm UTC
Oct 11, 2014 at 6:28pm UTC
put a "{" after the ")" of the if statement so that
the queue line, for loop, pID.push and cout run as a result of 'A'
Oct 11, 2014 at 6:40pm UTC
can try a switch and case for menu. how does the pID work?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
char input;
cout << "input from 1 to 6 " ;
cin input;
if (input >= 1 || input <= 6)
{
switch (input)
{
case '1' : runmenu1(); break ;
case '2' : runmenu2(); break ;
case '3' : runmenu3(); break ;
case '4' : runmenu4(); break ;
case '5' : runmenu5(); break ;
case '6' : runmenu6(); break ;
}
}
this example help?
Topic archived. No new replies allowed.