Help with assignment

hey,
my professor told me to do a program that prompts the user for an integer number,
displays the following menu:
1) number divisible by 3
2) number between 10 and 100

prompt the user to enter a choice, if the user enters the value 1, determine whether the vale 3 is a divisor of the integer number and output an appropriate message, if the user enters the value 2, determine whether the integer number is less than 10, between 10 and 100, or greater than 100 and output an appropriate message, i the user enters a value other than 1 or 2, output a message indicating that the value is not a menu item, it is not expected to loop back to show the menu again.

I just need help starting with the program, the rest of the part which is If else and looping, i know how to do it, but i have no idea how to start with the beginning.
thanks!!
Here is a starting point:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>

int main ()
{
  int number = 0;
  char choice = 0;

  std::cout << "Enter a number: ";
  std::cin >> number;

  std::cin.ignore (255, '\n');
  std::cout << "\n1) number divisible by 3";
  std::cout << "\n2) number between 10 and 100\n";
  std::cout << "Enter choice: ";
  std::cin >> choice;

  if (choice == '1')
  {
    // handle choice 1
  }
  else if (choice == '2')
  {
    // handle choice 2
  }
  else
  {
    // handle invalid choice
  }
  return 0;
}

here is a start. Just put your code in the different cases and in defalut you can put a default message saying that user entered wrong number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35


#include <iostream>
using namespace std;

int choice;

int num;


cout << " number divisible by 3"<<endl;
cout << "number between 10 and 100"<<endl;
  cout << "Enter choice: "<<endl;

cout  << "Enter a number: ";

cin>>choice endl;




switch (choice)


case 1:
  // Code
  break;
case 2:
  // Code
  break;
default:
  // Code
  break;
}
Last edited on
Topic archived. No new replies allowed.