fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. char choice;
  6. while (true) {
  7. int num1, num2;
  8.  
  9. cout << "Enter first number: ";
  10. cin >> num1;
  11. cout << "Enter second number: ";
  12. cin >> num2;
  13.  
  14. if (num1 > num2) {
  15. cout << num1 << " is greater than " << num2 << endl;
  16. } else if (num2 > num1) {
  17. cout << num2 << " is greater than " << num1 << endl;
  18. } else {
  19. cout << "Both numbers are equal." << endl;
  20. }
  21.  
  22. cout << "Do you want to compare again? (y/n): ";
  23. cin >> choice;
  24. if (choice != 'y') {
  25. break;
  26. }
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Enter first number: Enter second number: 32765 is greater than -1116627368
Do you want to compare again? (y/n):