This is my code
class AddResult
{
private:
string ar_stu_id, ar_mod1, ar_mod2, ar_mod3, ar_mark1, ar_mark2, ar_mark3;
public:
void addresult();
AddResult(string, string, string, string, string, string, string)
{
cout<<ar_stu_id <<" " << ar_mod1 <<" " << ar_mod2 <<" " << ar_mod3 <<" " << ar_mark1 <<" " << ar_mark2 <<" " << ar_mark3;
}
~AddResult()
{
cout<<"Complete!"<<endl<<endl;
}
};
void AddResult::addresult()
{
system("cls");
char con;
ofstream stu_mark;
cout<<"Please insert the following information.\n\n";
stu_mark.open ("StudentMarks.txt", fstream::in | fstream::out | fstream::ate | ios::app);
cout<<"Student ID\n";
getline(cin, ar_stu_id);
cout<<"Module 1"<<endl;
getline(cin, ar_mod1);
cout<<"Mark 1"<<endl;
getline(cin, ar_mark1);
cout<<"Module 2"<<endl;
getline(cin, ar_mod2);
cout<<"Mark 2"<<endl;
getline(cin, ar_mark2);
cout<<"Module 3"<<endl;
getline(cin, ar_mod3);
cout<<"Mark 3"<<endl;
getline(cin, ar_mark3);
{
AddResult(ar_stu_id, ar_mod1, ar_mod2, ar_mod3, ar_mark1, ar_mark2, ar_mark3);
}
stu_mark << ar_stu_id << " ";
stu_mark << ar_mod1 << " ";
stu_mark << ar_mark1;
stu_mark << " " << ar_mod2 << " ";
stu_mark << ar_mark2;
stu_mark << " " << ar_mod3 << " ";
stu_mark << ar_mark3 << endl;
stu_mark.close();
cout<<"Continue? (Y/N)";
cin>>con;
if(con=='y')
{
system("cls");
AddResult obj; <----no default constructor in Class AddResult
obj.addresult();
}
else if (con=='n')
{
Admin obj;
obj.works();
}
}
Anyone can help me?