Hey, I wanted to know if there was a way to use arrays in a class. I have a program that will calculate a students score, however I wanted to have an array where the "teacher" could type in the amount of students they have and could repeat the calculations as long as they have more students that need to be calculated. So far I have:
#include <iostream>
using namespace std;
class StudentScore{
private:
int quiz1, quiz2, midterm, final;
double total_quiz, final_mid, total_final, grade;
public:
void StudentScore::get_final()
{
cout<<"Input Final Exam Grade:"<<endl;
cin>>final;
while ((final>100)||(final<0))
{
cout<<"Not a valid grade, try again."<<endl;
cout<<"Input Final Exam Grade:"<<endl;
cin>>final;
}
total_final=final*.50;
}
void StudentScore::total()
{
grade=total_quiz+final_mid+total_final;
cout<<"Total Grade is: "<<grade<<endl;
}
I thought I might have to put people in a public name so I can use it in an array. Could someone please help a future programer in his freshman year of college out?
Please use the [code][ /code] wrapper and indents so that we can understand your code. And point out the part of your code where you have the problem so that we can help.