Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string uInitials="\0";
- double avgExam=0, tExam=0;
- int aExams[10]{0};
- int nExam=0, cExam=0;
- cout << "Enter your three initials!: ";
- cin >> uInitials;
- cout << "Enter your exam(s) to be averaged. Enter 0 when complete!\n";
- cin>>cExam;
- while(cExam!=0 && nExam<10)
- {
- aExams[nExam] = cExam;
- ++nExam;
- tExam += cExam;
- cin>>cExam;
- }
- avgExam = tExam/nExam;
- cout << "The average for initials: " << uInitials << " is: " << avgExam
- << "\nThis average was obtained using the following scores that were entered: " <<endl;
- for(int i = 0; i < nExam; ++i)
- {
- cout << aExams[i] << '\n';
- }
- cout<<endl;
Advertisement
Add Comment
Please, Sign In to add comment