Advertisement
Guest User

Untitled

a guest
May 20th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <iomanip>
  6. using namespace std;
  7. struct chancery_shop
  8. {
  9. char name[30];
  10. int price;
  11. int amount;
  12. char group_of_product[40];
  13. };
  14. int main()
  15. {
  16. setlocale(LC_ALL, "Russian");
  17. int a;
  18. chancery_shop *shop;
  19. do
  20. {
  21. cout << "Количество товара на складе ";
  22. cin >> a;
  23. } while (a <= 0);
  24. shop = new chancery_shop[a];
  25. cout << "Ввод информации о товарах " << endl;
  26. cout << endl;
  27.  
  28. for (int i = 0; i < a; i++)
  29. {
  30. cout << "Название ";
  31. cin >> shop[i].name;
  32. cout << "Цена ";
  33. cin >> shop[i].price;
  34. cout << "Количество ";
  35. cin >> shop[i].amount;
  36. cout << "Вид товара ";
  37. cin >> shop[i].group_of_product;
  38. }
  39. cout << "+----------+------+------------+-------------+" << endl;
  40. cout << "|Название |Цена |Количество |Вид товара |" << endl;
  41. cout << "+----------+------+------------+-------------+" << endl;
  42. for (int i = 0; i < a; i++)
  43. {
  44. cout << "|" << setw(10) << shop[i].name << "|" << setw(6) << shop[i].price << "|" << setw(12) << shop[i].amount << "|" << setw(13) << shop[i].group_of_product << "|"<< endl;
  45. cout << "+----------+------+------------+-------------+" << endl;
  46. }
  47. delete[] shop;
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement