Advertisement
Guest User

offf

a guest
Dec 9th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.73 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include "Structure.h"
  4. #include "stdio.h"
  5. #include "string.h"
  6.  
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {
  9. struct games game[10];
  10. struct sellers seller[5];
  11. struct buyers buyer[5];
  12. struct sellings selling[100];
  13. struct data dataProdagi;
  14. int choice = 0, schetchik = 0, proverka = 0, i, j, numbSellers = 5, numbBuyers = 5, numbGames = 10, vvod = 0, pokupka = 0, choice1 = 1;
  15. dataProdagi.day = 0;
  16. dataProdagi.month = 0;
  17. dataProdagi.year = 0;
  18. {
  19. strcpy(game[0].name, "Life is strange");
  20. strcpy(game[0].genre[0], "Action");
  21. strcpy(game[0].genre[1], "Adventure");
  22. strcpy(game[0].platforms[0], "Linux");
  23. strcpy(game[0].platforms[1], "Microsoft Windows");
  24. strcpy(game[0].platforms[2], "OS X");
  25. strcpy(game[0].platforms[3], "PlayStation 3");
  26. strcpy(game[0].platforms[4], "PlayStation 4");
  27. strcpy(game[0].platforms[5], "Xbox 360");
  28. strcpy(game[0].platforms[6], "Xbox One");
  29. strcpy(game[0].languages[0], "English");
  30. strcpy(game[0].languages[1], "French");
  31. strcpy(game[0].languages[2], "Italian");
  32. strcpy(game[0].languages[3], "German");
  33. strcpy(game[0].languages[4], "Spanish");
  34. strcpy(game[0].languages[5], "Portuguese-Brazil");
  35. game[0].id = 1;
  36. game[0].price = 419;
  37. game[0].selling = 0;
  38. game[0].numbOfGenre = 2;
  39. game[0].numbOfLanguages = 6;
  40. game[0].numbOfPlatforms = 5;
  41. }
  42. {
  43. strcpy(game[1].name, "Valiant Hearts: The Great War");
  44. strcpy(game[1].genre[0], "Puzzle adventure");
  45. strcpy(game[1].platforms[0], "Android");
  46. strcpy(game[1].platforms[1], "iOS");
  47. strcpy(game[1].platforms[2], "Microsoft Windows");
  48. strcpy(game[1].platforms[3], "PlayStation 3");
  49. strcpy(game[1].platforms[4], "PlayStation 4");
  50. strcpy(game[1].platforms[5], "Xbox 360");
  51. strcpy(game[1].platforms[6], "Xbox One");
  52. strcpy(game[1].languages[0], "English");
  53. strcpy(game[1].languages[1], "French");
  54. strcpy(game[1].languages[2], "Italian");
  55. strcpy(game[1].languages[3], "German");
  56. strcpy(game[1].languages[4], "Spanish");
  57. strcpy(game[1].languages[5], "Dutch");
  58. strcpy(game[1].languages[6], "Japanese");
  59. strcpy(game[1].languages[7], "Polish");
  60. strcpy(game[1].languages[8], "Portuguese-Brazil");
  61. strcpy(game[1].languages[9], "Russian");
  62. game[1].id = 2;
  63. game[1].price = 699;
  64. game[1].selling = 0;
  65. game[1].numbOfGenre = 1;
  66. game[1].numbOfLanguages = 10;
  67. game[1].numbOfPlatforms = 7;
  68. }
  69. {
  70. strcpy(game[2].name, "Tomb Raider");
  71. strcpy(game[2].genre[0], "Action");
  72. strcpy(game[2].genre[1], "Adventure");
  73. strcpy(game[2].platforms[0], "Linux");
  74. strcpy(game[2].platforms[1], "Microsoft Windows");
  75. strcpy(game[2].platforms[2], "OS X");
  76. strcpy(game[2].platforms[3], "PlayStation 3");
  77. strcpy(game[2].platforms[4], "PlayStation 4");
  78. strcpy(game[2].platforms[5], "Xbox 360");
  79. strcpy(game[2].platforms[6], "Xbox One");
  80. strcpy(game[2].languages[0], "English");
  81. strcpy(game[2].languages[1], "French");
  82. strcpy(game[2].languages[2], "Italian");
  83. strcpy(game[2].languages[3], "German");
  84. strcpy(game[2].languages[4], "Spanish");
  85. strcpy(game[2].languages[5], "Dutch");
  86. strcpy(game[2].languages[6], "Korean");
  87. strcpy(game[2].languages[7], "Polish");
  88. strcpy(game[2].languages[8], "Portuguese-Brazil");
  89. strcpy(game[2].languages[9], "Russian");
  90. game[2].id = 3;
  91. game[2].price = 399;
  92. game[2].selling = 0;
  93. game[2].numbOfGenre = 2;
  94. game[2].numbOfLanguages = 10;
  95. game[2].numbOfPlatforms = 7;
  96. }
  97. {
  98. strcpy(game[3].name, "Watch_Dogs 2");
  99. strcpy(game[3].genre[0], "Action");
  100. strcpy(game[3].genre[1], "Adventure");
  101. strcpy(game[3].platforms[0], "Microsoft Windows");
  102. strcpy(game[3].platforms[1], "PlayStation 4");
  103. strcpy(game[3].platforms[2], "Xbox One");
  104. strcpy(game[3].languages[0], "English");
  105. strcpy(game[3].languages[1], "French");
  106. strcpy(game[3].languages[2], "Italian");
  107. strcpy(game[3].languages[3], "German");
  108. strcpy(game[3].languages[4], "Spanish");
  109. strcpy(game[3].languages[5], "Dutch");
  110. strcpy(game[3].languages[6], "Korean");
  111. strcpy(game[3].languages[7], "Polish");
  112. strcpy(game[3].languages[8], "Portuguese-Brazil");
  113. strcpy(game[3].languages[9], "Russian");
  114. game[3].id = 4;
  115. game[3].price = 1999;
  116. game[3].selling = 0;
  117. game[3].numbOfGenre = 2;
  118. game[3].numbOfLanguages = 10;
  119. game[3].numbOfPlatforms = 3;
  120. }
  121. {
  122. strcpy(game[4].name, "Mirror's Edge");
  123. strcpy(game[4].genre[0], "Action");
  124. strcpy(game[4].genre[1], "Adventure");
  125. strcpy(game[4].platforms[0], "iOS");
  126. strcpy(game[4].platforms[1], "Microsoft Windows");
  127. strcpy(game[4].platforms[2], "Windows Phone");
  128. strcpy(game[4].platforms[3], "PlayStation 3");
  129. strcpy(game[4].platforms[4], "Xbox 360");
  130. strcpy(game[4].languages[0], "English");
  131. strcpy(game[4].languages[1], "French");
  132. strcpy(game[4].languages[2], "Italian");
  133. strcpy(game[4].languages[3], "German");
  134. strcpy(game[4].languages[4], "Spanish");
  135. strcpy(game[4].languages[5], "Dutch");
  136. strcpy(game[4].languages[6], "Hungarian");
  137. strcpy(game[4].languages[7], "Polish");
  138. strcpy(game[4].languages[8], "Portuguese");
  139. strcpy(game[4].languages[9], "Russian");
  140. game[4].id = 5;
  141. game[4].price = 299;
  142. game[4].selling = 0;
  143. game[4].numbOfGenre = 2;
  144. game[4].numbOfLanguages = 10;
  145. game[4].numbOfPlatforms = 5;
  146. }
  147. {
  148. strcpy(game[5].name, "Fahrenheit: Indigo Prophecy Remastered");
  149. strcpy(game[5].genre[0], "RPG");
  150. strcpy(game[5].genre[1], "Adventure");
  151. strcpy(game[5].platforms[0], "Linux");
  152. strcpy(game[5].platforms[1], "Microsoft Windows");
  153. strcpy(game[5].platforms[2], "Android");
  154. strcpy(game[5].platforms[3], "iOS");
  155. strcpy(game[5].platforms[4], "PlayStation 4");
  156. strcpy(game[5].platforms[5], "OS X");
  157. strcpy(game[5].languages[0], "English");
  158. strcpy(game[5].languages[1], "French");
  159. strcpy(game[5].languages[2], "German");
  160. strcpy(game[5].languages[3], "Spanish");
  161. game[5].id = 6;
  162. game[5].price = 249;
  163. game[5].selling = 0;
  164. game[5].numbOfGenre = 2;
  165. game[5].numbOfLanguages = 4;
  166. game[5].numbOfPlatforms = 6;
  167. }
  168. {
  169. strcpy(game[6].name, "BioShock Infinite");
  170. strcpy(game[6].genre[0], "Action");
  171. strcpy(game[6].platforms[0], "Linux");
  172. strcpy(game[6].platforms[1], "Microsoft Windows");
  173. strcpy(game[6].platforms[2], "OS X");
  174. strcpy(game[6].platforms[3], "PlayStation 3");
  175. strcpy(game[6].platforms[4], "PlayStation 4");
  176. strcpy(game[6].platforms[5], "Xbox 360");
  177. strcpy(game[6].platforms[6], "Xbox One");
  178. strcpy(game[6].languages[0], "English");
  179. strcpy(game[6].languages[1], "French");
  180. strcpy(game[6].languages[2], "Italian");
  181. strcpy(game[6].languages[3], "German");
  182. strcpy(game[6].languages[4], "Spanish");
  183. strcpy(game[6].languages[5], "Japanese");
  184. strcpy(game[6].languages[6], "Korean");
  185. strcpy(game[6].languages[7], "Polish");
  186. strcpy(game[6].languages[8], "Portuguese-Brazil");
  187. strcpy(game[6].languages[9], "Russian");
  188. game[6].id = 7;
  189. game[6].price = 999;
  190. game[6].selling = 0;
  191. game[6].numbOfGenre = 1;
  192. game[6].numbOfLanguages = 10;
  193. game[6].numbOfPlatforms = 7;
  194. }
  195. {
  196. strcpy(game[7].name, "Amnesia: The Dark Descent");
  197. strcpy(game[7].genre[0], "Action");
  198. strcpy(game[7].genre[1], "Adventure");
  199. strcpy(game[7].genre[2], "Indie");
  200. strcpy(game[7].platforms[0], "Linux");
  201. strcpy(game[7].platforms[1], "Microsoft Windows");
  202. strcpy(game[7].platforms[2], "OS X");
  203. strcpy(game[7].platforms[3], "PlayStation 4");
  204. strcpy(game[7].languages[0], "English");
  205. strcpy(game[7].languages[1], "French");
  206. strcpy(game[7].languages[2], "Italian");
  207. strcpy(game[7].languages[3], "German");
  208. strcpy(game[7].languages[4], "Spanish");
  209. strcpy(game[7].languages[5], "Russian");
  210. game[7].id = 8;
  211. game[7].price = 499;
  212. game[7].selling = 0;
  213. game[7].numbOfGenre = 3;
  214. game[7].numbOfLanguages = 6;
  215. game[7].numbOfPlatforms = 4;
  216. }
  217. {
  218. strcpy(game[8].name, "Alan Wake");
  219. strcpy(game[8].genre[0], "Action");
  220. strcpy(game[8].genre[1], "Adventure");
  221. strcpy(game[8].platforms[0], "Microsoft Windows");
  222. strcpy(game[8].platforms[1], "Xbox 360");
  223. strcpy(game[8].languages[0], "English");
  224. strcpy(game[8].languages[1], "French");
  225. strcpy(game[8].languages[2], "Italian");
  226. strcpy(game[8].languages[3], "German");
  227. strcpy(game[8].languages[4], "Spanish");
  228. strcpy(game[8].languages[5], "Japanese");
  229. strcpy(game[8].languages[6], "Korean");
  230. strcpy(game[8].languages[7], "Polish");
  231. strcpy(game[8].languages[8], "Traditional Chinese");
  232. strcpy(game[8].languages[9], "Russian");
  233. game[8].id = 9;
  234. game[8].price = 499;
  235. game[8].selling = 0;
  236. game[8].numbOfGenre = 2;
  237. game[8].numbOfLanguages = 10;
  238. game[8].numbOfPlatforms = 2;
  239. }
  240. {
  241. strcpy(game[9].name, "Outlast");
  242. strcpy(game[9].genre[0], "Action");
  243. strcpy(game[9].genre[1], "Adventure");
  244. strcpy(game[9].genre[2], "Indie");
  245. strcpy(game[9].platforms[0], "Linux");
  246. strcpy(game[9].platforms[1], "Microsoft Windows");
  247. strcpy(game[9].platforms[2], "OS X");
  248. strcpy(game[9].platforms[3], "PlayStation 4");
  249. strcpy(game[9].platforms[4], "Xbox One");
  250. strcpy(game[9].languages[0], "English");
  251. strcpy(game[9].languages[1], "French");
  252. strcpy(game[9].languages[2], "Italian");
  253. strcpy(game[9].languages[3], "German");
  254. strcpy(game[9].languages[4], "Spanish");
  255. strcpy(game[9].languages[5], "Japanese");
  256. strcpy(game[9].languages[6], "Polish");
  257. strcpy(game[9].languages[7], "Portuguese-Brazil");
  258. strcpy(game[9].languages[8], "Russian");
  259. game[9].id = 10;
  260. game[9].price = 499;
  261. game[9].selling = 0;
  262. game[9].numbOfGenre = 3;
  263. game[9].numbOfLanguages = 9;
  264. game[9].numbOfPlatforms = 5;
  265. }
  266. {
  267. strcpy(seller[0].name, "Dmitry Ivanov");
  268. seller[0].selling = 0;
  269. }
  270. {
  271. strcpy(seller[1].name, "Ivan Kuznecov");
  272. seller[1].selling = 0;
  273. }
  274. {
  275. strcpy(seller[2].name, "Svetlana Pushkina");
  276. seller[2].selling = 0;
  277. }
  278. {
  279. strcpy(seller[3].name, "Irina Vorobyeva");
  280. seller[3].selling = 0;
  281. }
  282. {
  283. strcpy(seller[4].name, "Karina Kukushkina");
  284. seller[4].selling = 0;
  285. }
  286. {
  287. strcpy(buyer[0].name, "Evgenia Lipina");
  288. buyer[0].selling = 0;
  289. }
  290. {
  291. strcpy(buyer[1].name, "Mihail Ryabcov");
  292. buyer[1].selling = 0;
  293. }
  294. {
  295. strcpy(buyer[2].name, "Nikita Svetlokov");
  296. buyer[2].selling = 0;
  297. }
  298. {
  299. strcpy(buyer[3].name, "Artem Prostakov");
  300. buyer[3].selling = 0;
  301. }
  302. {
  303. strcpy(buyer[4].name, "Kirill Gorshkov");
  304. buyer[4].selling = 0;
  305. }
  306. printf("1 sdelat' pokupku\n");
  307. printf("2 pokazat' informaciu o tovare\n");
  308. printf("3 nayti prodavca s naibol'shimi prodagami\n");
  309. printf("4 nayti pokupatelya s bol'shim kolichestvom pokupok\n");
  310. printf("5 nayti naibolee prodavaemy tovar\n");
  311. printf("6 Informacia o prodagah\n");
  312. printf("7 exit\n");
  313. while(choice != 7)
  314. {
  315. printf("Chto nugno sdelat'?\n");
  316. scanf("%d", &choice);
  317. switch(choice)
  318. {
  319. case 1:
  320. {
  321. while(proverka == 0)
  322. {
  323. selling[schetchik].salesman = (struct sellers*) malloc(sizeof(struct sellers)*1);
  324. selling[schetchik].shopper = (struct buyers*) malloc(sizeof(struct buyers)*1);
  325. selling[schetchik].time = (struct data*) malloc(sizeof(struct data)*1);
  326. selling[schetchik].numbOfSoldGames = 0;
  327. printf("Vvedite imya i familiu prodavca\n");
  328. gets(selling[schetchik].salesman->name);
  329. for(i = 0; i < numbSellers; i++)
  330. {
  331. if (strcmp(selling[schetchik].salesman->name, seller[i].name)== 0)
  332. {
  333. seller[i].selling++;
  334. proverka = 1;
  335. break;
  336. }
  337. }
  338. if(proverka == 0)
  339. printf("Takogo prodavca net\n");
  340. }
  341. proverka = 0;
  342. while(proverka == 0)
  343. {
  344. printf("Vvedite imya i familiu pocupatelya\n");
  345. gets(selling[schetchik].shopper->name);
  346. for(i = 0; i < numbBuyers; i++)
  347. {
  348. if (strcmp(selling[schetchik].shopper->name, buyer[i].name)== 0)
  349. {
  350. buyer[i].selling++;
  351. proverka = 1;
  352. break;
  353. }
  354. }
  355. if(proverka == 0)
  356. printf("Takogo pocupatelya net\n");
  357. }
  358. proverka = 0;
  359. {
  360. while(choice1 == 1)
  361. {
  362. selling[schetchik].soldGame[selling[schetchik].numbOfSoldGames] = (struct games*) malloc(sizeof(struct games)*1);
  363. while(proverka == 0)
  364. {
  365. printf("Vvedite kod igry\n");
  366. scanf("%d", &selling[schetchik].soldGame[selling[schetchik].numbOfSoldGames]->id);
  367. for(i = 0; i < numbGames; i++)
  368. {
  369. if (selling[schetchik].soldGame[selling[schetchik].numbOfSoldGames]->id = game[i].id)
  370. {
  371. game[i].selling++;
  372. proverka = 1;
  373. break;
  374. }
  375. }
  376. if(proverka == 0)
  377. printf("Takoy igry net\n");
  378. }
  379. proverka = 0;
  380. selling[schetchik].numbOfSoldGames++;
  381. printf("Prodolgit'? 1 - Da, 2 - Net\n");
  382. scanf("%d", &choice1);
  383. }
  384. }
  385. printf("Vvedite datu pokupki\n");
  386. scanf("%d.%d.%d", &selling[schetchik].time->day, &selling[schetchik].time->month, &selling[schetchik].time->year);
  387. schetchik++;
  388. pokupka = 1;
  389. proverka = 0;
  390. }
  391. break;
  392. case 2:
  393. printf("Vvedite kod tovara\n");
  394. scanf("%d", &vvod);
  395. for(i = 0; i < numbGames; i++)
  396. {
  397. if (vvod == game[i].id)
  398. {
  399. printf("Nazvanye: %s\n", game[i].name);
  400. for(j = 0; j < game[i].numbOfGenre; j++)
  401. printf("Ganry: %s\n", game[i].genre[j]);
  402. for(j = 0; j < game[i].numbOfPlatforms; j++)
  403. printf("Platformy: %s\n", game[i].platforms[j]);
  404. for(j = 0; j < game[i].numbOfLanguages; j++)
  405. printf("Yazyki: %s\n", game[i].languages[j]);
  406. printf("Cena: %d\n", game[i].price);
  407. proverka = 1;
  408. break;
  409. }
  410. }
  411. if(proverka == 0)
  412. printf("Takoy igry net\n");
  413. proverka = 0;
  414. break;
  415. case 3:
  416. if(pokupka == 0)
  417. printf("Segodnya ne bylo ni odnoy prodagi\n");
  418. else
  419. {
  420. vvod = 0;
  421. for(i = 0; i < numbSellers; i++)
  422. {
  423. if ( seller[i].selling > vvod)
  424. {
  425. vvod = seller[i].selling;
  426. j = i;
  427. }
  428. }
  429. printf("Luchshiy prodavec: %s, kolichestvo prodag: %d\n", seller[j].name, seller[j].selling);
  430. }
  431. break;
  432. case 4:
  433. if(pokupka == 0)
  434. printf("Segodnya ne bylo ni odnoy prodagi\n");
  435. else
  436. {
  437. vvod = 0;
  438. for(i = 0; i < numbBuyers; i++)
  439. {
  440. if ( buyer[i].selling > vvod)
  441. {
  442. vvod = buyer[i].selling;
  443. j = i;
  444. }
  445. }
  446. printf("Pokupatel' s naibolshim kolichestvom pokupok: %s, kolichestvo pokupok: %d\n", buyer[j].name, buyer[j].selling);
  447. }
  448. break;
  449. case 5:
  450. if(pokupka == 0)
  451. printf("Segodnya ne bylo ni odnoy prodagi\n");
  452. else
  453. {
  454. vvod = 0;
  455. for(i = 0; i < numbGames; i++)
  456. {
  457. if ( game[i].selling > vvod)
  458. {
  459. vvod = game[i].selling;
  460. j = i;
  461. }
  462. }
  463. printf("Naibolee prodavaemy tovar: %s, kolichestvo prodag: %d\n", game[j].name, game[j].selling);
  464. }
  465. break;
  466. case 6:
  467. if(pokupka == 0)
  468. printf("Segodnya ne bylo ni odnoy prodagi\n");
  469. else
  470. {
  471. printf("Vvedite datu prodagi\n");
  472. scanf("%d.%d.%d", &dataProdagi.day, &dataProdagi.month, &dataProdagi.year);
  473. for(i = 0; i < schetchik; i++)
  474. {
  475. if((dataProdagi.day == selling[i].time->day) && (dataProdagi.month == selling[i].time->month) && (dataProdagi.year == selling[i].time->year))
  476. {
  477. printf("Prodavec: %s\n", selling[i].salesman->name);
  478. printf("Pokupatel': %s\n", selling[i].shopper->name);
  479. printf("Kuplennye igry:");
  480. for(j = 0; j < selling[i].numbOfSoldGames; j++)
  481. printf("%s\n", selling[i].soldGame[j]->name);
  482. }
  483. }
  484. }
  485. break;
  486. case 7:
  487. printf("Do svidanya\n");
  488. break;
  489. default:
  490. printf("Ne vybran ne odin punkt");
  491. }
  492. }
  493. system ("pause");
  494. return 0;
  495. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement