Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct TAuto {
- string make = "";
- int year = 0;
- float volume = 0, consumption = 0;
- };
- int main() {
- int size;
- cout << "Enter the size of the list: ";
- cin >> size;
- TAuto* list = new TAuto[size];
- for (int i = 0; i < size; ++i) {
- cout << i + 1 << "\nMake: ";
- cin >> (list + i)->make;
- cout << "Year: ";
- cin >> (list + i)->year;
- cout << "Volume: ";
- cin >> (list + i)->volume;
- cout << "Consumption: ";
- cin >> (list + i)->consumption;
- }
- cout << endl << endl;
- int cnt = 0;
- for (int i = 0; i < size; ++i) {
- if ((list + i)->consumption < 10) ++cnt;
- if ((list + i)->volume > 3) {
- cout << "Auto " << i + 1
- << "\nMake: " << (list + i)->make
- << "\nYear: " << (list + i)->year
- << "\nVolume: " << (list + i)->volume
- << "\nConsumption: " << (list + i)->consumption
- << endl;
- }
- }
- cout << "The number of cars with consumption less than 10l: " << cnt << endl;
- delete[] list;
- return 0;
- }
- /*
- stdin:
- 5
- Zalupa
- 2006
- 5.5
- 30
- Sobaka
- 1966
- 1.9
- 5.6
- Huj
- 2001
- 3.3
- 25
- Abbbababab
- 0000
- 99999
- 0
- bbb
- 1812
- 2.2
- 1
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement