functions
Apr 1, 2013 at 10:00pm UTC
Write the function void readTestScores (double &exam, double &tavge) that does the following:
- print the prompt: "enter exam score:" than read the exam score
- print the prmpt: "enter all test scores:" then read 7 test scores in a loop, and than computer their average
- the exam score and the average of the test scores are returned to the calling function using the reference parameters exam and tavge respectively
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#include <iostream>
using namespace std;
void readTestScores(double & exam, double &tavge);
double computeFinalScore(double exam, double tavge);
char getLetterGrade(double score);
void printComment(char grade);
int main()
{
double exam; // a student's average exam score
double tavge; // a student's average test score
/*read the student's exam scores and computer their average*/
cout << endl << "Enter Students ID number:\t" ;
cout << endl << "Enter exam score:\t" ;
exam = computeFinalScore(1);
/*read the student's test score and computer their average*/
cout << endl << "Enter all test scores:\t" ;
tavge = computeFinalScore (7);
/*compute and print the student's average score*/
cout << endl << "The average score is:\t" << (.4 * tavge + .6 * exam;
char grade;
cout<<"\n Enter your Marks = " ;
cin>>marks;
if (marks>=80 && marks<=100)
grade='A' ;
elseif(marks>=70 && marks<80)
grade='B' ;
elseif(marks>=60 && marks<70)
grade='C' ;
elseif(marks>=50 && marks<60)
grade='D' ;
else
grade='F' ;
cout<<"\n Your Grade is = " <<grade<<endl;
getch( );
need help i need to add more and figure out what to do
Topic archived. No new replies allowed.