fork(1) download
  1. //Nicolas Ruano CS1A Chapter 4, Pp. 220, #
  2. //
  3. /******************************************************************************
  4.  * CALCULATING THE MAXIMUM AND THE MINIMUM
  5.  * ____________________________________________________________________________
  6.  * This program will ask the user regarding about inputing two numbers to tell
  7.  * which one of the numbers is more or less
  8.  * ____________________________________________________________________________
  9.  * INPUT
  10.  * num1 : The first number inputed by the user
  11.  * num2 : the second number inputed by the user
  12.  *
  13.  * OUTPUT
  14.  * The number that has the more or lease value compared to the other number
  15.  * themselves
  16. ******************************************************************************/
  17. #include <iostream>
  18. #include <limits> // For input validation
  19. using namespace std;
  20.  
  21. int main() {
  22. int num1; // INPUT : The first number the user has input
  23. int num2; // INPUT : The second number the user has input
  24.  
  25. // Ask User for the first number
  26. cout << "What is the first number?" << endl;
  27. cin >> num1;
  28.  
  29. // Ask User for the second number
  30. cout << "What is the second number?" << endl;
  31. cin >> num2;
  32.  
  33. // Determine which number has the least value
  34. if (num1 < num2)
  35. {
  36. cout << num1 << " is less than " << num2 << endl;
  37. }
  38. else
  39. {
  40. cout << num2 << " is less than " << num1 << endl;
  41. }
  42.  
  43.  
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
What is the first number?
What is the second number?
32764 is less than 1130153472