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.
1
Expert's answer
2012-10-24T10:01:06-0400
#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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS