0

Help please

Input two variables A B and put them on screen which is bigger.C++

4th Oct 2020, 6:26 PM
SSH
8 Answers
+ 1
The answer will be in python X=input=("plz enter the first number") Y=input("plz enter the second number") if X > Y : print("X is bigger than Y") elif X< Y : print("Y is bigger than X") elif X == Y : print("X equal to Y") else : print("error") The answer in C++ int x,y; cout<<"plz enter the first number"; x=cin>>; cout<<"plz enter the second number"; y=cin>>; if( x > y) cout<<"x is greater than y" ; elseif( x < y) cout<< "y is greater than x" ; elseif (x==y) ckut<<"x equal to y" ; else cout<<"error";
4th Oct 2020, 6:42 PM
Muhammad Galhoum
Muhammad Galhoum - avatar
0
Declare your variables they must be of type integer.Then get user input with cin>> method .then compare them using > making condition so then cout the greatest one.
4th Oct 2020, 6:37 PM
HBhZ_C
HBhZ_C - avatar
0
can you write the code?
4th Oct 2020, 6:40 PM
SSH
0
I just don't know anything about C++ for the first time
4th Oct 2020, 6:41 PM
SSH
0
How?
4th Oct 2020, 6:44 PM
SSH
0
Oh thanks bro❀✊
4th Oct 2020, 6:47 PM
SSH
- 1
//C++ source code #include <iostream> using namespace std; int main() { int a,b; //declaring variables cin>>a; //taking the value of a cin>>b; //taking the value of b if(a>b) //checking the number, which one is greater cout<<a; //showing a ,if a is greater else cout<<b; //showing b if b is greater return 0; } // :)
4th Oct 2020, 6:44 PM
Rupali Haldiya
Rupali Haldiya - avatar