Build a BMI program for the following functions: Allocate an array of 10 element
ID: 3668639 • Letter: B
Question
Build a BMI program for the following functions: Allocate an array of 10 elements using parallel arrays for: name, weight, height, BMI (use BMI=(W*702)/H*H Accept up to 10 persons data for BMI calculation At end list all elements in this format: SN Name Weight Height BMI Provide data retrieval service for user to enter name, the program Displays: Name, Weight, Height, BMI Feature: Check for none existed names and notify user Allow repeated operation until user stops it then Display number of retrieval services Thank You For Using My ProgramExplanation / Answer
/*write a function that will implement each Fibonacci number with the help
of an integer array of size 100 (elements of this array will be digits of the Fibonacci number).
When the function is called to find Fn, it will calculate all Fibonacci numbers
from F2 to Fn using the basic formula Fn=F(n-1) + F(n-2). To add two Fibonacci numbers, the function
will add elements of two arrays corresponding to F(n-1) and F(n-2) and store their sums in the array
corresponding to Fn. (You are NOT supposed to store ALL arrays.) Write a program that will calculate
Fibonacci numbers containing up to 100 digits. Display the biggest Fibonacci number that has less than 100 digits.
Make sure that your program will display the error message when a Fibonacci number has 100 digits or more. */
#include<iostream>
#include<string>
using namespace std;
main()
{
int i,show_count=0,num=0,weight[10],height[10];
char flag='n';
float BMI[10];
string name[10],show_details="";
while(num==0)
{
cout<<"How many person's data you want to enter?(Max 10) : ";
cin>>num;
if(num>10 || num < 1)
{
cout<<" Invalid input. Please try again. ";
num=0;
}
}
for(i=0;i<num;i++)
{
cout<<"Please enter Name, Weight, hight (Separated by space): ";
cin>>name[i]>>weight[i]>>height[i];
BMI[i]=(weight[i]*702)/(float)(height[i]*height[i]);
}
cout<<" SN Name Weight Height BMI";
cout<<" === ====== ==== ==== ====";
for(i=0;i<num;i++)
{
cout<<" "<<i+1<<" "<<name[i]<<" "<<weight[i]<<" "<<height[i]<<" " <<BMI[i];
}
while(1==1)
{
cout<<" Please enter the name to see the data.(Type exit to terminate) : ";
cin>>show_details;
if(show_details == "exit")
{
cout<<" Thank You For Using My Program";
return 0;
}
else
{
for(i=0;i<num;i++)
{
if(name[i]==show_details)
{
cout<<" SN Name Weight Height BMI";
cout<<" === ====== ==== ==== ====";
cout<<" "<<i+1<<" "<<name[i]<<" "<<weight[i]<<" "<<height[i]<<" " <<BMI[i];
show_count++;
flag = 'y';
}
}
if(flag=='n')
cout<<" Name provided by you is not found. Please try again!";
flag = 'n';
}
}
}
//Hope it helps. :-)
//If you have any query or confusion, please leave a comment, I’ll try to explain in more details.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.