Advertisement
tosip

Untitled

Jun 8th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     // Find the greatest number
  8.  
  9.     // Take two number input from user
  10.     int num1,num2;
  11.  
  12.     cin>>num1;//12 - 19
  13.     cin>>num2;//13 - 10
  14.     //alternative approach to take multiple input
  15.     //cin>> num1 >> num2;
  16.  
  17.     //comparison
  18.  
  19.     if(num1>num2)
  20.     {
  21.         //"\n", endl is used for linebreak or nextline
  22.         cout << num1<<"\n";
  23.         cout << "Turja\n"<<"Sinha\n";
  24.         cout << "Sinha"<<endl;
  25.         cout << num1 << " is greater than "<<num2<<endl;
  26.     }
  27.     else if(num2>num1)
  28.     {
  29.        cout << num2 << " is greater than "<<num1<<endl;
  30.     }
  31.     else
  32.     {
  33.         cout<<num1 <<" is equal to "<<num2<<endl;
  34.     }
  35.     // 19 is greater than 10
  36.  
  37.     // string collection of characters
  38.     // datatype variableName;
  39.     string name;
  40.     //take string input from user
  41.     cin>> name;
  42.     // print string
  43.     cout<<name;
  44.  
  45.     string fullName;
  46.     // To take user input which includes space
  47.     //getline(cin,variableName)
  48.     getline(cin,fullName);
  49.     cout<<fullName;
  50.  
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement