-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRohanmain.cpp
41 lines (39 loc) · 982 Bytes
/
Rohanmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include "Tree.h"
#include "Car.h"
using namespace std;
int main() {
int numCars;
string model;
string brand;
int year;
double horsepower;
double cityMPG;
double highwayMPG;
string fuel;
double price;
// double gears;
Tree tree(3, 2);
cin >> numCars;
while(numCars!=0){
cin >> model;
cin >> brand;
cin >> year;
cin >> horsepower;
cin >> cityMPG;
cin >> highwayMPG;
cin >> fuel;
cin >> price;
// cin >> gears;
Car* car = new Car(model, brand, year, horsepower, cityMPG, highwayMPG,
fuel, price/*, gears*/);
tree.Insert(car);
numCars--;
}
vector<Car*> test = tree.Search(tree.getRoot(), 90, 2010);
cout << "Cars within that year range:" << endl;
for(auto iter = test.begin(); iter != test.end(); iter++){
cout << (*iter)->getModel() << endl;
}
return 0;
}