Hello friends, I am not sure what I am doing wrong here. I am new to C++ programing.
Define an array or a vector of class to store studnets information. Then write a main function to populate the array (vector) nd display it by the member function. The student class has member variable name, mark, address, as well as display() member function to display the member variables.
int main(){
student = s[5];
int n;
for(n=0; n <5; n++)
{
cout << " Please enter your name 'quit' " << endl;
getline (cin, s[n].name);
if (s[n].name=="quit")
break;
cout <<"Please enter your mark" << endl;
cin >> s[n].mark;
cin.ignore(1);
cout <<" Please enter your address " << endl;
getline(cin, s[n].address);
}
for (int i=0; i <n; i++)
{
s[i].display();
}
}
Where have you been having trouble? What have you tried so far?
If you let us know what you've tried, we can know how to help you better. But we can't just hand you a solution.
If you have issues/errors/wrong output, let us know where the issues are and we can investigate it faster.
They haven't been defined anywhere. You need to define these. In your original comment, you already listed everything the class needs to have in it. You need to use that to define the class.