blob: c02fd2157f301e4f98190b9215d6d21d84b065ad (
plain) (
blame)
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
|
#include <iostream>
#include "product.h"
int main() {
unsigned productsCount;
std::cin >> productsCount;
Product* products = new Product[productsCount];
for (unsigned i = 0; i < productsCount; ++i) {
std::cin >> products[i].ID;
std::cin.ignore();
std::cin.getline(products[i].name, MAX_NAME_LENGTH);
}
for (unsigned i = 0; i < productsCount; ++i) {
unsigned ID, stockSize;
std::cin >> ID >> stockSize;
for (unsigned i = 0; i < productsCount; ++i) {
if (products[i].ID == ID) {
products[i].stockSize = stockSize;
break;
}
}
}
for (unsigned i = 0; i < productsCount; ++i) {
std::cout << products[i].name << ": " << products[i].stockSize << std::endl;
}
delete[] products;
return 0;
}
|