Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- // Find the greatest number
- // Take two number input from user
- int num1,num2;
- cin>>num1;//12 - 19
- cin>>num2;//13 - 10
- //alternative approach to take multiple input
- //cin>> num1 >> num2;
- //comparison
- if(num1>num2)
- {
- //"\n", endl is used for linebreak or nextline
- cout << num1<<"\n";
- cout << "Turja\n"<<"Sinha\n";
- cout << "Sinha"<<endl;
- cout << num1 << " is greater than "<<num2<<endl;
- }
- else if(num2>num1)
- {
- cout << num2 << " is greater than "<<num1<<endl;
- }
- else
- {
- cout<<num1 <<" is equal to "<<num2<<endl;
- }
- // 19 is greater than 10
- // string collection of characters
- // datatype variableName;
- string name;
- //take string input from user
- cin>> name;
- // print string
- cout<<name;
- string fullName;
- // To take user input which includes space
- //getline(cin,variableName)
- getline(cin,fullName);
- cout<<fullName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement