find and fix all the errors so the code can run #ifndef Student.h #define Student.h class CStudent{ private: char Student_name[50]; int Student_id; char Student_email_username[10]; char Student_major[10]; float Student_grades[5]; float Student_score; char Student_email_
find and fix all the errors so the code can run
#ifndef Student.h
#define Student.h
class CStudent{
private:
char Student_name[50];
int Student_id;
char Student_email_username[10];
char Student_major[10];
float Student_grades[5];
float Student_score;
char Student_email_password[10];
public:
CStudent();
char *get_Student_name();
int get_student_id();
char *get_Student_email_username();
char *get_Student_major();
float *get_Student_grades();
float get_Student_score();
char *get_Student_email_password();
//set methods
void set_Student_name(char *name);
void set_student_id(int id);
void set_Student_email_username(char *username);
void set_Student_major(char *major);
void set_Student_grades(float *grades);
void set_Student_score(float score);
void set_Student_email_password(char *password);
};
#endif
#include "Student.h"
#include <cstddef>
CStudent::CStudent()
{
Student_name[50]={};
Student_id=0;
Student_email_username[10]={};
Student_major[10]={};
Student_grades[5]=0;
Student_score=0;
Student_email_password[10]={};
}
char CStudent:: *get_Student_name()
{
return Student_name;
}
CStudent::~CStudent(){delete s[];}
int CStudent:: get_Student_id()
{
return Student_id;
}
char CStudent:: *get_Student_email_username()
{
return Student_email_username;
}
char CStudent:: *get_Student_major()
{
return Student_major;
}
float CStudent:: *get_Student_grades()
{
return Student_grades;
}
float CStudent:: get_Student_score()
{
return Student_score;
}
char CStudent:: *get_Student_email_password()
{
return Student_email_password;
}
void CStudent:: set_Student_name(char *name)
{
Student_name=name;
}
void CStudent:: set_Student_id(int id)
{
Student_id=id;
}
void CStudent:: set_Student_email_username(char *username)
{
Student_email_username=username;
}
void CStudent:: set_Student_major(char *major)
{
Student_major=major;
}
void CStudent:: set_Student_grades(float *grades)
{
Student_grades=grades;
}
void CStudent:: set_Student_score(float score)
{
Student_score=score;
}
void CStudent:: set_Student_email_password(char *password)
{
Student_email_password=password;
}
void CStudent:: getStudentInfo(){
CStudent (char Student_name[50], int Student_id, char Student_email_username[10], char Student_major[10],
float Student_grades[5], float Student_score, char Student_email_password[10])
{
cout<<"The student's name:"<<Student_name<<endl;
cout<<"The student's id:"<<Student_id<<endl;
cout<<"The student's email username:"<<Student_email_username<<endl;
cout<<"The student's major:"<<Student_major<<endl;
cout<<"The student's grades:"<<Student_grades<<endl;
cout<<"The student's score:"<<Student_score<<endl;
cout<<"The student's email password:"<<Student_email_password<<endl;
}
void calculateGPA(char Student_name[50], int Student_id, char Student_email_username[10], char Student_major[10],
float Student_grades[5], float Student_score, char Student_email_password[10])
{
int sum;
cout<<"Enter the no of students";
cin>>n;
for(int j=0;j<n;j=j+5)
{
for(int i=0;i<5;i++)
{
sum=sum+grades[i];
}
student_score=sum/100;
}
}
void registerStudent()
{
char Student_name[50];
cout<<"please enter student's name:";
getline(Student_name, 50);
int Student_id;
cout<<"please enter student's id:";
cin>>Student_id;
char Student_email_username[10];
// prompt for the student's Email
cout<<"please enter student's email username:";
getline(Student_email_username, 10);
char Student_major[10];
cout<<"please enter student's major:";
getline(Student_major, 10);
float Student_grades[5];
for (int i=1; i<=5; i++)
{
cout<<"please enter student's grades in Subject "<<i <<" :";
cin>>Student_grades[i];
}
float Student_score;
cout<<"please enter student's score:";
cin>>Student_score;
char Student_email_password[10];
cout<<"please enter student's email password:";
getline(Student_email_password, 10);
}
Step by step
Solved in 2 steps with 6 images