Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <stdio.h>
  5. #include <string.h>
  6. using namespace std;
  7.  
  8. struct product
  9. {
  10. char name[20];
  11. char kolich[20];
  12. };
  13.  
  14. int main()
  15. {
  16. int n, i, k, *num, j;
  17. cout << "Input number of workstations: ";
  18. cin >> n;
  19. product **a;
  20. a = new product*[n];
  21. num = new int[n];
  22. for (i = 0; i<n; i++)
  23. {
  24. fflush(stdin);
  25. cout << "Input data of the production from workstation № " << i + 1 << ":" << endl;
  26. cout << "How many product make this workstation? Input: ";
  27. cin >> num[i];
  28. a[i] = new product[num[i]];
  29. for (j = 0; j < num[i]; j++)
  30. {
  31. fflush(stdin);
  32. gets_s(a[i][j].name);//input name
  33. cin >> a[i][j].kolich;// input quantity
  34. }
  35. }
  36. cout << "Input number workstation(for this workstation will output name and quantity of production): ";
  37. cin >> k;
  38. for (j = 0; j < num[k-1]; j++)
  39. cout << a[k-1][j].name << " " << a[k-1][j].kolich<<endl;
  40. delete[]a;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement