Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. struct build {
  8. struct {
  9. int proc;
  10. int vklad;
  11. int nevypl;
  12. }client;
  13. string type;
  14. int price;
  15. string firma;
  16. };
  17.  
  18. int main() {
  19.  
  20. setlocale(LC_ALL, "Russian");
  21.  
  22. int type0 = 0;
  23. int type1 = 0;
  24. int type2 = 0;
  25. int type3 = 0;
  26. int type4 = 0;
  27.  
  28. srand(time(NULL));
  29.  
  30. build arr[10];
  31.  
  32. string proc[5] = { "100","200","300","400","500" };
  33. string vklad[5] = { "2000","4100","5500","10200","130500" };
  34. string nevypl[5] = { "200","102","3040","7574","10" };
  35. string type[5] = { "Магазин","Частный дом","Многоэтажный дом","Офис","Торговый центр" };
  36. string price[5] = { "10000","16627","5445","75848","500" };
  37. string firma[5] = { "Silpo","DeKo","Jilstroy-2","Metalon","Karavan" };
  38.  
  39. for (int i = 0; i<10; i++) {
  40.  
  41. arr[i].firma = firma[rand() % 5];
  42. arr[i].price = stoi(price[rand() % 5]);
  43. arr[i].type = type[rand() % 5];
  44. arr[i].client.nevypl = stoi(nevypl[rand() % 5]);
  45. arr[i].client.proc = stoi(proc[rand() % 5]);
  46. arr[i].client.vklad = stoi(vklad[rand() % 5]);
  47.  
  48. if (arr[i].type == type[0])type0++;
  49. if (arr[i].type == type[1])type1++;
  50. if (arr[i].type == type[2])type2++;
  51. if (arr[i].type == type[3])type3++;
  52. if (arr[i].type == type[4])type4++;
  53.  
  54. cout << "Фирма:" << arr[i].firma << " ";
  55. cout << "Стоимость:" << arr[i].price << " ";
  56. cout << "Тип строения:" << arr[i].type << " ";
  57. cout << "Невыплата:" << arr[i].client.nevypl << " ";
  58. cout << "Процент:" << arr[i].client.proc << " ";
  59. cout << "Вклад:" << arr[i].client.vklad << " ";
  60.  
  61.  
  62. cout << endl;
  63. }
  64. cout << "Тип построек заказанных больше 2 раз:" << endl;
  65. if (type0 >= 2) cout << type[0] << endl;
  66. if (type1 >= 2) cout << type[1] << endl;
  67. if (type2 >= 2) cout << type[2] << endl;
  68. if (type3 >= 2) cout << type[3] << endl;
  69. if (type4 >= 2) cout << type[4] << endl;
  70.  
  71. system("pause");
  72. return 0;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement