35.3k views
2 votes
C++: Samantha and Vikas are looking to buy a house in a new development. After looking at various models, the three models they like are colonial, split-entry, and single-story. The builder gave them the base price and the finished area in square feet of the three models. They want to know the model(s) with the least price per square foot. 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 model(s) with the least price per square foot.

1 Answer

2 votes

Answer:

Step-by-step explanation:

#include <iostream>

#include <iomanip>

#include <ostream>

#include <string>

using namespace std;

int main()

{

int x = 100;

int a,y;

double price[100], sqft[100], solution[100];

a = 1;

y = 0;

do

{

if (x!=0)

{

x++;

}

cout << "\tPlease enter your houses base price for it's model : $";

cin >> price[x];

cout << "\tPlease now enter that house's total sqft : ";

cin >> sqft[x];

solution[x]=price[x] / sqft[x];

system("pause");

system("cls");

cout << fixed;

cout << "\tYour value Per Sqaure foot for this house is " << setprecision(2) << solution[x] << endl;

system("pause");

cout << "\tWould You like to Enter another House? (1 - Yes 0 - No) ";

cin >> a;

if (a = 0)

{

x = y;

}

system("pause");

system("cls");

} while (a != 0);

system("pause");

return 0;

}

User Bhanu Sinha
by
6.4k points