Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <iomanip>
- #include <stdio.h>
- #include <string.h>
- using namespace std;
- struct product
- {
- char name[20];
- char kolich[20];
- };
- int main()
- {
- int n, i, k, *num, j;
- cout << "Input number of workstations: ";
- cin >> n;
- product **a;
- a = new product*[n];
- num = new int[n];
- for (i = 0; i<n; i++)
- {
- fflush(stdin);
- cout << "Input data of the production from workstation № " << i + 1 << ":" << endl;
- cout << "How many product make this workstation? Input: ";
- cin >> num[i];
- a[i] = new product[num[i]];
- for (j = 0; j < num[i]; j++)
- {
- fflush(stdin);
- gets_s(a[i][j].name);//input name
- cin >> a[i][j].kolich;// input quantity
- }
- }
- cout << "Input number workstation(for this workstation will output name and quantity of production): ";
- cin >> k;
- for (j = 0; j < num[k-1]; j++)
- cout << a[k-1][j].name << " " << a[k-1][j].kolich<<endl;
- delete[]a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement