What did I do wrong Now?
Alright now I have new errors:
1>------ Build started: Project: qqqqq, Configuration: Debug Win32 ------
1> qqqqqqqq.cpp
1>qqqqqqqq.obj : error LNK2019: unresolved external symbol "public: void __thiscall StudentClass::output(class StudentClass)" (?output@StudentClass@@QAEXV1@@Z) referenced in function _main
1>qqqqqqqq.obj : error LNK2019: unresolved external symbol "public: void __thiscall StudentClass::Grade(class StudentClass &)" (?Grade@StudentClass@@QAEXAAV1@@Z) referenced in function _main
1>qqqqqqqq.obj : error LNK2019: unresolved external symbol "public: void __thiscall StudentClass::input(class StudentClass &)" (?input@StudentClass@@QAEXAAV1@@Z) referenced in function _main
1>qqqqqqqq.obj : error LNK2019: unresolved external symbol "public: void __thiscall StudentClass::input(void)" (?input@StudentClass@@QAEXXZ) referenced in function _main
1>qqqqqqqq.obj : error LNK2019: unresolved external symbol "public: __thiscall StudentClass::StudentClass(void)" (??0StudentClass@@QAE@XZ) referenced in function _main
1>c:\users\me\documents\visual studio 2010\Projects\qqqqq\Debug\qqqqq.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here is my newer code:
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
#include <iostream>
using namespace std;
const int CLASS_TOTAL_STUDENTS = 5;
class StudentClass
{
public:
StudentClass();
void input();
void Grade();
void output();
int studentNumber;
double firstQuiz;
double secondQuiz;
double gradeMidterm;
double gradeFinal;
double gradeAverage;
char grade;
void input(StudentClass & student);
void Grade(StudentClass & student);
void output(const StudentClass student);
};
int main()
{
StudentClass student[CLASS_TOTAL_STUDENTS];
StudentClass student1;
student1.input();
for(int i = 0; i < CLASS_TOTAL_STUDENTS; i++)
student1.input(student[i]);;
{ for(int i = 0; i < CLASS_TOTAL_STUDENTS; i++)
{
student1.Grade(student[i]);;
student1.output(student[i]);
cout << endl;
}
}
return 0;
}
void input(StudentClass & student)
{
cout << "Please Enter the Student's Number: ";
cin >> student.studentNumber;
cout << student.studentNumber << endl;
cout << "Enter both 10 Point Quizes" << endl;
cin >> student.firstQuiz >> student.secondQuiz;
cout << student.firstQuiz << " " << student.secondQuiz << endl;
cout << "Enter both 100 Point Midterm and Final. \n";
cin >> student.gradeMidterm >> student.gradeFinal;
cout << student.gradeMidterm << " " << student.gradeFinal <<endl;
}
void Grade(StudentClass & student)
{
double quizAvg= (student.firstQuiz + student.secondQuiz)/2.0;
double quizAvgNormalized = quizAvg * 10;
student.gradeAverage = student.gradeFinal * 0.5 +
student.gradeMidterm * 0.25 +
quizAvgNormalized * 0.25;
char letterGrade[]= "FFFFFFDCBAA";
int index = static_cast<int>(student.gradeAverage/10);
if(index < 0 || 10 <= index)
{
cout << "Grade entered resulted in an ERROR: "
<< student.gradeAverage << endl << " ENDED.\n";
abort();
}
student.grade = letterGrade[index];
}
void output(const StudentClass student)
{
cout << "Grade for student number: "
<< student.studentNumber << endl
<< "Quiz grades are: "
<< student.firstQuiz << " " << student.secondQuiz << endl
<< "The Exam grades are: " << student.gradeMidterm << " " << student.gradeFinal << endl
<< "Average: " << student.gradeAverage << endl
<< "letter grade is " << student.grade << endl;
}
|