fork download
  1. /*******************************************************************************
  2.  * calculate the greater of two numbers
  3. *_______________________________________________________________________________
  4. * display if a or b is bigger
  5. *_______________________________________________________________________________
  6. *INPUT
  7. * number a
  8. * numnber b
  9. *OUTPUT
  10. * a/b is bigger
  11. *******************************************************************************/
  12. #include <iostream>
  13. using namespace std;
  14.  
  15. int main() {
  16. int numa;
  17. int numb;
  18. int answ;
  19. int less;
  20. cout << "WHICH NUMBER IS GREATER \nenter a number\n";
  21. cin>>numa;
  22. cout << "enter another number\n";
  23. cin>>numb;
  24.  
  25. answ = (numa>numb) ? numa : numb;
  26. less = (numa>numb) ? numb : numa;
  27.  
  28. cout << " \nanswer: " << answ << " is greater than " <<less<< ".";
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5320KB
stdin
0
600
stdout
WHICH NUMBER IS GREATER 
enter a number
enter another number
 
answer: 600 is greater than 0.