Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

What is the purpose of Form 8109, Federal Tax Deposit Coupon?

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago

Question

Derive expressions for the rates of forward and reverse reactions?

Answered: 1 week ago

Question

Write an expression for half-life and explain it with a diagram.

Answered: 1 week ago