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
7.9k points

Related questions

asked Sep 2, 2024 168k views
Luc DUZAN asked Sep 2, 2024
by Luc DUZAN
7.3k points
1 answer
2 votes
168k views
asked Jul 22, 2024 200k views
Kkress asked Jul 22, 2024
by Kkress
8.6k points
1 answer
4 votes
200k views
asked Feb 18, 2024 142k views
Svkaka asked Feb 18, 2024
by Svkaka
8.3k points
1 answer
2 votes
142k views