Question: 1) Partially filled arrays Copy-paste your code from warm-up 3 into a new file as a starting point for this problem. Modify your main() function

1) Partially filled arrays Copy-paste your code from warm-up 3 into a new file as a starting point for this problem. Modify your main() function to allow any number of names and heights to be entered (instead of just 2). You will need to use a partially filled array to do this. (You can assume that there will not be more than 100 people.)

My Code from warmup 3:

#include using namespace std;

string requestName(); double requestHeight(string fullName); int requestNumberOfPartners(); void printArray(string fullName[], double height[]);

int main(){ string fullName[2]; double height[2];

for(int i = 0; i < 2; i++){ fullName[i] = requestName(); height[i] = requestHeight(fullName[i]); } printArray(fullName, height); }

string requestName(){ string name; cout << "Please enter full name: "; getline(cin, name); return name; }

double requestHeight(string fullName){ double height; cout << "Please enter " << fullName << "'s height: "; cin >> height; cin.ignore(2, ' ');

return height; }

int requestNumberOfPartners(){ int numberOfPartners; cout << "How many partners are there?"; cin >> numberOfPartners;

return numberOfPartners; }

void printArray(string fullName[], double height[]){ cout << "If " << fullName[0] << " and " << fullName[1] << " stand on top of each other, their combined height will be " << (height[0] + height[1])<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!