Question: #include using namespace std; int main() { // Get all the student details int n = 50; for (int i = 0; i < n;

#include

using namespace std;

int main() {

// Get all the student details

int n = 50;

for (int i = 0; i< n; i++)

{

cout << " Enter student " << (i + 1) << " details : " << endl;

cout << "Name : ";

string name;

cin >> name;

double gpa;

do{

cout << "GPA : ";

cin >> gpa;

if(gpa>=4.0){

cout<<"Please enter GPA less than 4.0 ";

}

}while(gpa>=4.0);

cout << "Major : ";

string major;

cin >> major;

// create a new student with the user data

//Student s(name, gpa, major);

// insert the student to the list of students

//students[i] = s;

}

cout << " The students details are : ";

for (int i = 0; i

cout << " Student " << (i + 1) << " details : " << endl;

//students[i].display();

}

return 0;

}

output:

is there anyway to leave an error message for the name and major. example the uset enters number instead of characters?? amd it gives an error message such as "this is an invalid entry. im using VS so keep that in mind

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!