64 689
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #16837 in C++ for Destiny Dupree

Question #16837
Write a program that accepts as input the base price and the finished area in square feet of the three models. The program outputs the models with the least price per square foot.
Expert's answer
#include<iostream.h>

float bp[3], fa[3], p[3], m;
int i, k;

void main(){

for (i=0; i<3; i++){
& cout<<"Enter base price of the model number "<<i<<": ";
& cin>>bp[i];
& cout<<"Enter finished area of the model number "<<i<<": ";
& cin>>fa[i];
& p[i] = bp[i]/fa[i];
}

m = p[0]; k = 0;
for (i=1; i<3; i++) { if (p[i]<m) m = p[i]; k = i; }

cout<<"The least price for the square foot is "<<m<<" model number "<<i<<".\n";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions