Displaying Averages in a Table

I've finally been able to get my coding corrected after doing this for 5 hours and watching numerous tutorials on it... But I now need assistance to create a table. Our teacher never told us how to create a table with dashed lines like -----------------, both vertical and horizontal.

Another issue I have is that I'm having trouble trying to get a prompt to ask the user how many programs, tests, and quizzes he/she completed with their total points. I got the basic programming done, but need a prompt asking "How many (quizzes, tests, or programs) have you completed?"

Finally, the do-while loop is driving me insane, where I have to set certain values. If it is greater than 2, then I insert formula 1, but if it is less than 2, then I insert formula 2. Whichever way it goes, the total points earned minus the two lowest scores are then calculated into an average.

Code:
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main()

{ //Programs

int max = 11;
float i, poss, max1, avg1;
for (i = 0; i < 11;i++)
{

cout << " Program points you got: ";
cin >> poss;
cout << " Program possible points: ";
cin >> max1;

avg1 = poss / max * 100;

}



int i1 = 12;
float avg2, poss1, max2, sum;
for (i1 = 0; i1 <=12;i1++)
do
{ //Quizzes
cout << " Quiz points you got: " << endl;
cin >> poss1;
cout << " Quiz possible points: " << endl;
cin >> max2;

cout << "Sum of two lowest scores: " << endl;
cin >> sum;

i1 = i1 +1;
avg2 = poss1 - sum / max2 * 100;
}


while (i1 <=12);

int i2 = 3; //Tests
float avg3, poss2, max3;
for (i2 = 0; i2 < 3;i2++)
while (i2 < 3)
{
cout << " Test points you got: " << endl;
cin >> poss2;
cout << " Test possible points: " << endl;
cin >> max3;

i2 = i2 + 1;
avg3 = poss2 / max3 * 100;

}

float testavg;
{
testavg = (poss2 + poss1 - sum) / (max3 + max2) * 100; //Test and quiz average
}


}

The whole basis of the program is to calculate the averages of programs, tests, and quizzes done during a semester at a school. The user is asked how many of each category he/she has completed (total points earned and total points possible). All of this is then calculated into a cumulative class average in a table along with points earned and points possible for each category (along with tests and quizzes combined into one average along with individual averages).

I've had a hell of a time trying to get this far -__-... I apologize for the wall of text and the messiness that is my coding, but 6 hours staring at a screen trying to figure this out isn't helping.

Any help would be just awesome. Thank you alot
hmmm...1st select all your code and place code tags round it by clicking the 1st format button. Identify the problems where you want help.
You probably should transform the variable testavg into a function to print out the testavg value.
This is the quiz instructions
Quizzes are next. Ask the user to enter the number of quizzes that have been taken during the semester. If the number of quizzes is greater than 0, write a do...while loop that will calculate the total number of quiz points. The body of the loop should:

prompt the user for a single quiz score. This prompt should include the quiz number.

add the single quiz score to the total quiz points earned

If more than 2 quizzes were taken, ask the user for the sum of the two lowest quiz scores and calculate the maximum possible quiz points using the formula:

Maximum Possible Quiz Points = (number of quizzes - 2) * 10
If 2 or fewer quizzes were taken, set the sum of the two lowest quizzes to 0 and calculate the maximum possible quiz points using the formula:

Maximum Possible Quiz Points = number of quizzes * 10
Use the sum of the two lowest quiz scores and the maximum possible quiz points to calculate the quiz average using the formula:

Quiz Average = (total quiz points - sum of the two lowest quiz scores) / Maximum Possible Quiz Points * 100
If no quizzes have been taken at this point in the semester, set the quiz average to 0.0.
________________________________

For all sections: I want to prompt the user how many he/she has gotten points for (ie, How many quizzes have you taken? "5". That way, only 5 options would appear).

I then take all this and put it into a table displaying program, quiz, and test points total vs points possible. The quizzes and tests are then added together to get a combined average. Finally, the grade average is then displayed
Last edited on
Topic archived. No new replies allowed.