Question
I must write a C++ console program that prompts a user to enter attributes for three students and output the data in a formatted table.
I must write a C++ console program that prompts a user to enter attributes for three students and output the data in a formatted table.
To do so, I must write a value-returning function that will collect the data from the user for 1 student and store it in a struct, and that will be called three different times from the main function (one for each student).
The struct must look like this:
struct Student
{
string name;
int id;
string address;
string major;
double gpa;
};
I am having trouble with the function, I am trying to pass the struct to the function by reference but can't for all three students. I need to have a function that will get all the info for the first student and store it in a struct, then call the function again for the second student and same for the third student. The data for all three students must be output in a formatted table
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