can anyone solve this problem for me ???
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include<iostream>
#include<string>
#define size 10
using namespace std;
struct student {
string name;
int id;
string prog;
double cgpa;
};
class stinfo {
private:
student data[size];
int last;
public:
stinfo();
void add(string name, int id, string prog, double cgpa);
};
stinfo :: stinfo()
{
last = 0 ;
}
void stinfo::add(string name, int id,string prog, double cgpa)
{
if (last == data[size]) {
return ;
}
data[last].name = name;
data[last].id = id;
data[last].prog = prog;
data[last].cgpa = cgpa;
++last;
}
int main()
{
char ans;
string name1,prog1;
int id1;
double cgpa1;
stinfo st;
cout <<endl;
cout <<">>>>> INSERT NEW STUDENT INFORMATION <<<<<"<<endl;
cout <<"NAME : ";
cin >>name1;
cout <<"ID: ";
cin >>id1;
cout <<"PROGRAMME : ";
cin >>prog1;
cout <<"CGPA: ";
cin >>cgpa1;
st.add ( name1,id1,prog1,cgpa1 );
system("pause");
return 0;
}
`