Guest User

Untitled

a guest
Sep 5th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. string uInitials="\0";
  2. double avgExam=0, tExam=0;
  3. int aExams[10]{0};
  4. int nExam=0, cExam=0;
  5.  
  6. cout << "Enter your three initials!: ";
  7. cin >> uInitials;
  8. cout << "Enter your exam(s) to be averaged. Enter 0 when complete!\n";
  9. cin>>cExam;
  10.  
  11. while(cExam!=0 && nExam<10)
  12. {
  13.  
  14. aExams[nExam] = cExam;
  15. ++nExam;
  16. tExam += cExam;
  17. cin>>cExam;
  18.  
  19. }
  20.  
  21. avgExam = tExam/nExam;
  22.  
  23. cout << "The average for initials: " << uInitials << " is: " << avgExam
  24. << "\nThis average was obtained using the following scores that were entered: " <<endl;
  25.  
  26. for(int i = 0; i < nExam; ++i)
  27. {
  28. cout << aExams[i] << '\n';
  29. }
  30. cout<<endl;
Advertisement
Add Comment
Please, Sign In to add comment