Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int higher(int a, int b)
  7. {
  8. if (a>b)
  9. {
  10. return a;
  11. }
  12. else
  13. {
  14. return b;
  15. }
  16. }
  17.  
  18. int higher4(int a, int b, int c, int d)
  19. {
  20. }
  21.  
  22.  
  23. int main() {
  24.  
  25. const int array_size = 4;
  26. int scores[array_size];
  27.  
  28. int larger = 0;
  29. int larger4 = 0;
  30.  
  31.  
  32. for (int i = 0; i<array_size; i++)
  33. {
  34. cout << "Enter Score: ";
  35. cin >> scores[i];
  36. }
  37.  
  38. larger = higher(scores[1], scores[2]);
  39.  
  40. larger4 = higher4(scores[1], scores[2], scores[3], scores[4]);
  41.  
  42.  
  43. cout << "The higher score from the first 2 scores is " << larger << endl;
  44. cout << "The higher score out of all 4 scores is " << larger4 << endl;
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement