Guest User

Untitled

a guest
Oct 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. // Rules:
  5. // User will enter in 4 numbers: a, b, c, d
  6. // a > b, b < c, c = d
  7.  
  8. int main() {
  9. int num1,
  10. num2,
  11. num3,
  12. num4;
  13. bool success = false;
  14.  
  15. while (!success) {
  16. cout << "Enter 4 numbers." << endl;
  17. cout << "(1): ";
  18. cin >> num1;
  19.  
  20. cout << "(2): ";
  21. cin >> num2;
  22.  
  23. cout << "(3): ";
  24. cin >> num3;
  25.  
  26. cout << "(4): ";
  27. cin >> num4;
  28.  
  29. if (num1 > num2) {
  30. cout << "The first number looks good!" << endl;
  31. success = true;
  32. }
  33. else {
  34. cout << "The first number needs some fixing..." << endl;
  35. success = false;
  36. }
  37.  
  38. if (num2 < num3) {
  39. cout << "The second number looks good!" << endl;
  40. success = true;
  41. }
  42. else {
  43. cout << "The second number needs some fixing..." << endl;
  44. success = false;
  45. }
  46.  
  47. if (num3 == num4) {
  48. cout << "The third number looks good!" << endl;
  49. success = true;
  50. }
  51. else {
  52. cout << "The third number needs some fixing..." << endl;
  53. success = false;
  54. }
  55.  
  56. if (num4 == num3) {
  57. cout << "The fourth number looks good!" << endl;
  58. success = true;
  59. }
  60. else {
  61. cout << "The fourth number needs some fixing..." << endl;
  62. success = false;
  63. }
  64. }
  65.  
  66. return 0;
  67. }
Add Comment
Please, Sign In to add comment