+ 2

How to make an int represent all numbers??

How would i get int num1 to represent all numbers and int num2 to represent all numbers so when a user types in two numbers. The program will tell you which number is greater. Right now I have int num1 = 1; and int num2 = 2; so therefore the program is only recognizing only these two numbers. I want it to represent all numbers. For instance, if a user types in 12 space 13.. i would like the program to recognize all numbers and not just 1 and 2. https://code.sololearn.com/cg2nOrCAKwgE/?ref=app

8th Feb 2018, 1:14 PM
Lilmook4real
Lilmook4real - avatar
4 Answers
+ 1
The simplest way is to use input via cin, which receives input from console and saves it to your variables. Eg : int num 1, num 2; cin>>num1>>num2; cout<<(num1>num2)?"Greater":"Smaller";
8th Feb 2018, 1:32 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 3
what's your aim? finding largest among two?
8th Feb 2018, 1:31 PM
code learner
code learner - avatar
+ 2
Thank you guys for the replies. Kinshuk vasisht I'll try that today.
8th Feb 2018, 1:53 PM
Lilmook4real
Lilmook4real - avatar
+ 2
it worked. Thanks guys 😎😎 https://code.sololearn.com/ccT9PO3Pr4ej/?ref=app
8th Feb 2018, 2:12 PM
Lilmook4real
Lilmook4real - avatar