+ 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
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";
+ 3
what's your aim? finding largest among two?
+ 2
Thank you guys for the replies. Kinshuk vasisht I'll try that today.
+ 2
it worked. Thanks guys šš https://code.sololearn.com/ccT9PO3Pr4ej/?ref=app