0

Can someone please help me making a program that takes two values(int) identify which is smaller and add 1 in it and show it?

In c++ using ternary operator

11th Nov 2019, 6:57 PM
Muhammad Abdullah
Muhammad Abdullah - avatar
5 odpowiedzi
+ 1
int a,b; cin >> a >> b; int small = a<b?a:b; cout << small+1 << endl;
11th Nov 2019, 7:02 PM
Avinesh
Avinesh - avatar
0
Thank you
11th Nov 2019, 7:03 PM
Muhammad Abdullah
Muhammad Abdullah - avatar
0
Learn the concept well before you attempt a problem.
11th Nov 2019, 7:05 PM
Avinesh
Avinesh - avatar
0
I knew what to do I just was confused in writing a code identifying the smaller value
11th Nov 2019, 7:07 PM
Muhammad Abdullah
Muhammad Abdullah - avatar
0
Being happy with being 'confused' and asking other people to solve your practice task will only accomplish one thing: You won't learn how to program.
11th Nov 2019, 11:40 PM
HonFu
HonFu - avatar