I'm working on writing a grade program with 2 quizes, one midterm and one final exam. I need the program to ask for the data, output it back out and include the average numeric score and a final letter grade. I have to use a structure. So far, I have the structure and it asks for the data but it won't output anything. I have not yet tried to work on the output of a letter grade. Here's what I have so far. What am I missing to get it to output everything.
#include<iostream>
using namespace std;
struct studentRecord // collection of student grades
{
int quiz1, quiz2;
double midterm, finalExam, quizAve, score;
};
A few problrems here.
1) Your function doesn't return anything.
2) You're not using the return value, so why declare the function as returning a double?
3) The values you calculate in the function are all local and are lost when the function exits.
youare29 posted a calc function which tries to update studentRecord, but there is a problem with his code. grades is passed by value, therefore any changes to the struct are local and are lost when calcResults exits. Changing the function to pass grades by reference will fix the problem.
double calcResults (studentRecord & grades)
PLEASE USE CODE TAGS (the <> formatting button) when posting code. http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.