class course
{
private:
char Type;
int Credit;
int maxStud;
char Title[29];
char crsName[7];
public:
course();
void set_Credit(int);
void get_Credit();
void set_maxStud(int);
void get_maxStud();
void set_Type(char);
void get_Type();
void set_crsName(char []);
void get_crsName();
};
Constructor:
course::course()
{
Credit = 3;
maxStud = 20;
Type = 'U';
Title[0] = '\0';
}
These are the functions :
The set_crsName and get_crsName are the functions that are not working:
void course::set_crsName(char name[])
{
strncpy(crsName , name, 7);
name[2] = '\0';
}
void course::get_crsName()
{
for (int i = 0; i <29 ; i++)
cout<<crsName[i];
}
The main function:
course math;
math.set_crsName("MAT");
Could you guide me on the problem please.
Thank you

New Topic/Question
Reply




MultiQuote







|