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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started