Question: Can anyone help with my code, please?? I'm getting some errors and I need to modify the code. These are the instructions: Your code should
Can anyone help with my code, please?? I'm getting some errors and I need to modify the code.
These are the instructions:
Your code should include the 2 functions getStudent and display.
Make the following modifications before you submit your code:
Define the struct in main, not in a header file
Add cout statements to make the input and output more user friendly
test your code to ensure it is accurate.
Input validation is NOT required. You can assume you have a smart user who will input appropriate data types.
This is in the header file:
#include
struct Person
{
std::string name;
int age;
double height;
std::string eyeColor;
};
This is in main
#include
#include "Person.h"
using namespace std;
Person getStudent(Person x);
void display(Person x);
int main()
{
Person Students[3];
for (int i = 0; i < 3; i++)
{
Students[i] = getStudents(Students[i]);
}
for (int i = 0; i < 3; i++)
{
displayStudents(Students[i]);
}
return 0;
}
Person getStudent(student x)
{
cin << x.name;
cin << x.age;
cin << x.height;
cin << x.eyecolor;
return x;
}
void display(Person x)
{
cout << x.name << endl;
cout << x.age << endl;
cout << x.height << endl;
cout << x.eyecolor << endl;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
