New to programming assistance is appreciate

I'm not very good with programming at all and i have an assignment due tomorrow. I am to make a program that will calculate a students grade, given test and quiz scores. i would have to input a "T" for test or "Q" for quiz while an "X" to exit. Test scores are multiplied by two while the tests have 50 questions and quizes have 25 questions. After all information has been entered the program is to calculate and display total points earned and the overall letter grade. Grading scale is a standard 10 point scale. I've included my rough setup and key word 'rough' setup. It's my experiment with the layout. Anyway any help would be appreciated...


//Calculates the total points earned on quizes and tests,
//and then displays total points earned and assigns a grade

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main ()
{
//declare values
double testScore = 0.0;
double quizScore = 0.0;
double pointsEarned1 = 0.0;
double pointsEarned2 = 0.0;
double pointsPossible1 = 0.0;
double pointsPossible2 = 0.0;
int numberOfScores1 = 0;
int numberOfScores2 = 0:
double totalPointsEarned = 0.0;
double totalPointsPossible = 0.0;
char grade = ' ';

//Get quiz scores
cout << "First quiz score (X to stop): ";
cin >> quizScore;

while (quizScore = 'X');
{
//add score to accumulator
totalEarned1 = (pointsEarned1 + testScore);

//get next score
cout << "Next quiz score (X to stop): ";
cin >> quizScore;
}

//Get test scores
cout << "First test score (X to stop): ";
cin >> testScore;

while (testScore = 'X');
{
//add score to accumulator
totalEarned2 = 2*(pointsEarned2 + testScore);

//get next score
cout << "Next test score (X to stop): ";
cin >> testScore;
}

//get points earned
totalPointsEarned = pointsEarned1 + pointsEarned2

//get points possible
totalPointsPossible = pointsPossible1 + pointsPossible2;

//assign grade
if (totalPointsEarned >= (totalPointsPossible*.9))
grade = 'A';
else if (totalPointsEarned >= (totalPointsPossible*.8))
grade = 'B';
else if (totalPointsEarned >= (totalPointsPossible*.7))
grade = 'C';
else if (totalPointsEarned >= (totalPointsPossible*.6))
grade = 'D';
else grade = 'F';
//end ifs

//displays total points and grade
cout << endl;
cout << "Total Score: " << totalScore << endl;
cout << "Grade: " << grade << endl;

return 0;
} //end main function
I think you mean:

while (testScore != 'X');
and
while (quizScore != 'X');

Also, next time use [code][/code] tags please.
Last edited on
Topic archived. No new replies allowed.