Question: This code it's not working, fix it for me please #include using namespace std; class People { string name; double height; public: void setName(string name)
This code it's not working, fix it for me please
#include
class People { string name; double height; public: void setName(string name) { this->name = name; } void setHeight(double height) { this->height = height; } double getHeight() { return height; } string getName() { return name; } }; int main() { const int size = 100; string name; double height; double tallest; double smallest; int groupSize; int tallindex, smallindex; cout << "How large is your group? 100 is the limit: "; cin >> groupSize;
People people[size];
for (int i = 0; i
tallest = people[0].getHeight(); smallest = people[0].getHeight();
for (int i = 0; i tallest = people[i].getHeight(); tallindex = i; } if (smallest>people[i].getHeight()) { smallest = people[i].getHeight(); smallindex = i; } } cout << " The tallest person is " << people[tallindex].getName() << endl; cout << " The smallest person is " << people[smallindex].getName() << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
