Gargit

Conditional Statements Exercises Part 2

Jul 30th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void main()
  4. {
  5.     int y = 0;
  6.     int x = 0;
  7.  
  8.     std::cout << "Enter first digit: ";
  9.     std::cin >> x;
  10.     std::cout << "Enter second digit: ";
  11.     std::cin >> y;
  12.  
  13.     if (x > y)
  14.     {
  15.         std::cout << "The larger digit is: " << x << std::endl;
  16.     }
  17.     else if (y > x)
  18.     {
  19.         std::cout << "The larger digit is: " << y << std::endl;
  20.     }
  21.     else
  22.     {
  23.         std::cout << "The digits are the same!";
  24.     }
  25.  
  26.     system("pause");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment