Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "product.hpp"
- using namespace std;
- int main() {
- Product product[10];
- cout << "Введите количество товаров: ";
- int n;
- cin >> n;
- for (int i = 0; i<n; i++) {
- string name, unit;
- double amount, price;
- cout << "Введите информацию о " << i+1 << " товаре:" << endl;
- cout << "Название продукта: ";
- cin >> name;
- cout << "Единица измерения: ";
- cin >> unit;
- cout << "Количество продаваемой продукции: ";
- cin >> amount;
- cout << "Цена за 1 " << unit << ": ";
- cin >> price;
- cout << endl;
- product[i] = Product(name, price, unit, amount);
- }
- for (int i = 0; i<n; i++) {
- product[i].buy(rand() % 3 + 1);
- }
- for (int i = 0; i<=1; i++) {
- cout << "На продаже товара " << product[i].getName() << " вы заработали " << product[i].getProfit() << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement