I cannot figure out how to "call" the functions into the main. Please help!!

// ******************************************************************
//
//  Grades.cpp
//
//  This program computes student grades. For each student, two
//  quiz grades (graded on a 10 point basis), one midterm exam grade
//  and one final exam grade (each on a 100 point basis) are read
//  in. The final numeric grade is computed weighing the final 
//  exam 50%, the midterm 25%, and the quizzes 25%. The numeric
//  grade and corresponding letter grade are output.
//
// ******************************************************************
#include <iostream>
using namespace std;                       


//declarations
double quiz1;
double quiz2;
double midtermExam;
double finalExam;
double courseAverage;
//
// Structure for a student record
struct StudentRecord
{
//member functions
int quiz1, quiz2, midtermExam, finalExam, courseAverage, letterGrade;
};

//
//function declarations
void inputRecord (StudentRecord record);
//postcondition 
void computeAverage (StudentRecord& record);
//precondition
char letterGrade (double numericGrade);
//precondition
void outputRecord (StudentRecord record);
//precondition

//
//main function - declares StudentRecord, Calls functions into action
int main()
{
StudentRecord record;
void inputRecord (StudentRecord.record);
void computeAverage (StudentRecord.record);
char letterGrade (double numericGrade);
void outputRecord (StudentRecord.record);
}

//
//input definition
void inputRecord (StudentRecord record)
{ 
  cout << "Please Enter Your Grades Below" << endl << "Quiz Scores: ";
  cin >> quiz1;
  cout << " and "; 
  cin >> quiz2; 
  cout << endl;
  cout << "Midterm Exam Score: ";
  cin >> midtermExam; 
  cout << endl;
  cout << "Final Exam Score: ";
  cin >> finalExam;
  cout << endl;
}

//
// average definition
void computeAverage (StudentRecord& record)
{
  const double EXAM_WT = 0.5;
  const double MIDTERM_WT = 0.25;
  const double QUIZ_WT = 0.25;
  double quiz1Percent, quiz2Percent;

  // Convert the 10 point quizzes to a percent, then find the average
  quiz1Percent = 100 * record.quiz1 / 10.0;
  quiz2Percent = 100 * record.quiz2 / 10.0;
  double quizAvg = (quiz1Percent + quiz2Percent) / 2;

  // Compute the weighted average to get the numeric course grade
  record.courseAverage = quizAvg * QUIZ_WT + record.midtermExam * MIDTERM_WT + 
  record.finalExam * EXAM_WT;

  // Call the letterGrade function to find the letter grade
  record.letterGrade = letterGrade (record.courseAverage);
} 

//
// letterGrade defintion
char letterGrade (double numericGrade)
{
  char letter;

  if (numericGrade < 60)
    letter = 'F';
  else if (numericGrade < 70)
    letter = 'D';
  else if (numericGrade < 80)
    letter = 'C';
  else if (numericGrade < 90)
    letter = 'B';
  else
    letter = 'A';

  return letter;
}


//output definition
void outputRecord (StudentRecord record)
{
  cout << endl;
  cout << "Quiz Scores: " << record.quiz1 << "  " << record.quiz2 << endl;
  cout << "Midterm Exam Score: " << record.midtermExam << endl;
  cout << "Final Exam Score: " << record.finalExam << endl;
  cout << endl;
  cout << "Course Average: " << record.courseAverage << endl;
  cout << "Final Letter Grade: " << record.letterGrade << endl;
  cout << endl;
}

First of all, trash these globals at the top of the program!

double quiz1;
double quiz2;
double midtermExam;
double finalExam;
double courseAverage;

That's why you made a struct. So you wouldn't have to use globals. If you need to modify values inside one of your functions, use references or pointers. That's what they're there for.

Also, don't put the function's return type when calling. For example, this is wrong in main():

void inputRecord (StudentRecord.record);

Another thing is that when you're passing record , it's just that: record. You don't need to prefix it with StudentRecord. .

And don't forget that you need to pass a reference to inputRecord. Otherwise you'll just lose the values that the user inputted when the function returns.

This article has been dead for over six months. Start a new discussion instead.