continuing program until instructed by user

closed account (4y64izwU)
.....
Last edited on
you can use while like
cout<<enter an input;
cin >>input
while(input!="x"){
cout<<enter an input;
}
closed account (4y64izwU)
....
Last edited on
closed account (1CfG1hU5)
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
closed account (4y64izwU)
.....
Last edited on
closed account (1CfG1hU5)
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'
closed account (1CfG1hU5)
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.