Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <ctime>
- using namespace std;
- struct build {
- struct {
- int proc;
- int vklad;
- int nevypl;
- }client;
- string type;
- int price;
- string firma;
- };
- int main() {
- setlocale(LC_ALL, "Russian");
- int type0 = 0;
- int type1 = 0;
- int type2 = 0;
- int type3 = 0;
- int type4 = 0;
- srand(time(NULL));
- build arr[10];
- string proc[5] = { "100","200","300","400","500" };
- string vklad[5] = { "2000","4100","5500","10200","130500" };
- string nevypl[5] = { "200","102","3040","7574","10" };
- string type[5] = { "Магазин","Частный дом","Многоэтажный дом","Офис","Торговый центр" };
- string price[5] = { "10000","16627","5445","75848","500" };
- string firma[5] = { "Silpo","DeKo","Jilstroy-2","Metalon","Karavan" };
- for (int i = 0; i<10; i++) {
- arr[i].firma = firma[rand() % 5];
- arr[i].price = stoi(price[rand() % 5]);
- arr[i].type = type[rand() % 5];
- arr[i].client.nevypl = stoi(nevypl[rand() % 5]);
- arr[i].client.proc = stoi(proc[rand() % 5]);
- arr[i].client.vklad = stoi(vklad[rand() % 5]);
- if (arr[i].type == type[0])type0++;
- if (arr[i].type == type[1])type1++;
- if (arr[i].type == type[2])type2++;
- if (arr[i].type == type[3])type3++;
- if (arr[i].type == type[4])type4++;
- cout << "Фирма:" << arr[i].firma << " ";
- cout << "Стоимость:" << arr[i].price << " ";
- cout << "Тип строения:" << arr[i].type << " ";
- cout << "Невыплата:" << arr[i].client.nevypl << " ";
- cout << "Процент:" << arr[i].client.proc << " ";
- cout << "Вклад:" << arr[i].client.vklad << " ";
- cout << endl;
- }
- cout << "Тип построек заказанных больше 2 раз:" << endl;
- if (type0 >= 2) cout << type[0] << endl;
- if (type1 >= 2) cout << type[1] << endl;
- if (type2 >= 2) cout << type[2] << endl;
- if (type3 >= 2) cout << type[3] << endl;
- if (type4 >= 2) cout << type[4] << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement