Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- struct car
- {
- std::string name;
- int year;
- };
- int main()
- {
- int carsintotal;
- std::cout << "Ile samochodow chcesz skatalogowac? ";
- std::cin >> carsintotal;
- car * counted = new car[carsintotal];
- for (int i = 0; i < carsintotal; i++)
- {
- std::cout << "Samochod nr." << i + 1 << ":\n";
- std::cout << "Prosze podac marke: ";
- std::cin >> counted[i].name;
- std::cout << "Prosze podac rok produkcji: ";
- std::cin >> counted[i].year;
- }
- for (int i = 0; i < carsintotal; i++)
- {
- std::cout << counted[i].year << " " << counted[i].name << std::endl;
- }
- system("pause");
- delete[] counted;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement