Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help finishing this #include<iostream> #include<string> #include<conio.h>

ID: 3800702 • Letter: I

Question

I need help finishing this

#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
struct people
{
   string name;
   float feet;
   float inch;

};

int main()
{
   int const SIZE = 100;
   people p[SIZE];
   int groupSize;
   double tallest;
   double smallest;
   int tallindex, smallindex;
   int i = 0;

   cout << "How large is your group? 100 is the limit: ";
   cin >> groupSize;

   while (i<groupSize)
   {
       cout << "Enter the first name of the person " << i + 1 << endl;
       cin >> p[i].name;
       cout << "Input their height in feet " << endl;
       cin >> p[i].feet;
       cout << "Input their height in inch " << endl;
       cin >> p[i].inch;
       i++;
   }
  
   tallest = p[i].feet;
   smallest = p[i].feet;

   for (int i = 0; i < groupSize; i++)
   {
       if (tallest < p[i].feet)
       {

           tallest = p[i].feet;
           tallindex = i;
       }

       if (smallest > p[i].feet)
       {
           smallest = p[i].feet;
           smallindex = i;
       }
   }
       cout << " The tallest person is " << p[tallindex].name << " at " << p[i].feet << " feet " << p[i].inch << " inches."<< endl;
       cout << " The smallest person is " << p[smallindex].name << " at " << p[i].feet << " feet " << p[i].inch << " inches." << endl;

       return 0;


}

Explanation / Answer

#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
struct people
{
   string name;
   float feet;
   float inch;

};

int main()
{
   int const SIZE = 100;
   people p[SIZE];
   int groupSize;
   double tallest;
   double smallest;
   int tallindex, smallindex;
   int i = 0;

   cout << "How large is your group? 100 is the limit: ";
   cin >> groupSize;

   while (i<groupSize)
   {
       cout << "Enter the first name of the person " << i + 1 << endl;
       cin >> p[i].name;
       cout << "Input their height in feet " << endl;
       cin >> p[i].feet;
       cout << "Input their height in inch " << endl;
       cin >> p[i].inch;
       i++;
   }
  
   tallest = p[i].feet;
   smallest = p[i].feet;

   for (int i = 0; i < groupSize; i++)
   {
       if (tallest < p[i].feet)
       {

           tallest = p[i].feet;
           tallindex = i;
       }

       if (smallest > p[i].feet)
       {
           smallest = p[i].feet;
           smallindex = i;
       }
   }
       cout << " The tallest person is " << p[tallindex].name << " at " << p[i].feet << " feet " << p[i].inch << " inches."<< endl;
       cout << " The smallest person is " << p[smallindex].name << " at " << p[i].feet << " feet " << p[i].inch << " inches." << endl;

       return 0;


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote