#include<iostream> #include <string> using namespace std; struct Cars //Car stru
ID: 3616041 • Letter: #
Question
#include<iostream>
#include <string>
using namespace std;
struct Cars //Car structure
{
int vin,year;
string model, make;
double price;
};
int main()
{
Cars forsale;
int x;
cout << "how many cars are there?" << endl;
cin >> x;
//dataaquisition
for (int i = 1; i<=x;i++)
{
cout << "What is the vin for car: " << i <<endl;
cin >> forsale.vin;
cout << "what is the price for car: " << i <<endl;
cin >> forsale.price;
cout << "what is the year for car: " << i <<endl;
cin >> forsale.year;
cout << "what is the model for car: " << i <<endl;
cin >> forsale.model;
cout << "what is the make for car: " << i <<endl;
cin >> forsale.make;
}
//price range
int range;
cout << "What is the maximum you are willing to pay for thecar?" << endl;
cin >> range;
if (forsale.price <=range)
{
cout << forsale.price << endl;
cout << forsale.make << endl;
cout << forsale.model << endl;
cout << forsale.year << endl;
}
cout << "The priceis: " << forsale.price << endl;
return 0;
}
Explanation / Answer
please rate - thanks you need to use an array of structures #include #include using namespace std; struct Cars //Car structure { int vin,year; string model, make; double price; }; int main() { Cars forsale[50]; int x; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.