fork download
  1. //Ivy Whitney CSC 5 chp. 3, Q# 2
  2.  
  3. /************************************************************
  4. *
  5. *CALCULATE TEST AVERAGES
  6. _____________________________________________________________
  7. * This program will display the average of 5 test scores.
  8. * ==================Variables===============================
  9. *
  10. * INPUTs
  11. *
  12. * testScore1
  13. * testScore2
  14. * testScore3
  15. * testScore4
  16. * testScore5
  17. *
  18. * OUTPUTs
  19. *
  20. * avgScore
  21. *
  22. * ==========================================================
  23. * The MATH...
  24. *
  25. * testScore1 + testScore2 + testScore3 + testScore4 + testScore5 / 5
  26. **************************************************************/
  27.  
  28. #include <iostream>
  29. #include <iomanip>
  30. #include <cmath>
  31.  
  32. using namespace std;
  33. int main() {
  34.  
  35. //variable time!
  36. double testScore1 ;
  37. double testScore2 ;
  38. double testScore3 ;
  39. double testScore4 ;
  40. double testScore5 ;
  41. double avgScore ;
  42.  
  43.  
  44. //User inputs
  45.  
  46. cout << " Enter your test score below.\n";
  47. cin >> testScore1;
  48. cout << " Enter your test score below.\n";
  49. cin >> testScore2;
  50. cout << " Enter your test score below.\n";
  51. cin >> testScore3;
  52. cout << " Enter your test score below.\n";
  53. cin >> testScore4;
  54. cout << " Enter your test score below.\n";
  55. cin >> testScore5;
  56. //MATH
  57.  
  58. avgScore = (testScore1 + testScore2 + testScore3 + testScore4 + testScore5) / 5 ;
  59.  
  60. cout << "Your average score is " << fixed << setprecision(1) << avgScore << " !\n";
  61.  
  62. return 0;
  63.  
  64. }
  65.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
 Enter your test score below.
 Enter your test score below.
 Enter your test score below.
 Enter your test score below.
 Enter your test score below.
Your average score is 0.0 !