Writing a switch statement with two random numbers

closed account (ENh0ko23)
I am confused because i have to use two numbers between 1 and 100 that corresponds with a bunch of statements. For example the statements i have to use are "The first number is odd/even., the first number is/ is not divisible by the first number and etc."
Any help thanks!

So far i have:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 #include <iostream>
using namespace std;
int main()
{
	int firstnum;
	int secondnum;

	cout << "Please enter two integers in the range 1-100 inclusive." << endl;
	cin >> firstnum;
	cin >> secondnum;
	
	
	cin.get();
return 0;
}
Last edited on
the first number is always divisible by the first number. The answer is 1.

etc does not cut it for weird rules... depending on what the rules are, a switch may or may not work. You may have to nest if/else instead.

switches work off a SINGLE integer type.
it seems likely that a switch won't work here...

Topic archived. No new replies allowed.