Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include "Structure.h"
- #include "stdio.h"
- #include "string.h"
- int _tmain(int argc, _TCHAR* argv[])
- {
- struct games game[10];
- struct sellers seller[5];
- struct buyers buyer[5];
- struct sellings selling[100];
- struct data dataProdagi;
- int choice = 0, schetchik = 0, proverka = 0, i, j, numbSellers = 5, numbBuyers = 5, numbGames = 10, vvod = 0, pokupka = 0, choice1 = 1;
- dataProdagi.day = 0;
- dataProdagi.month = 0;
- dataProdagi.year = 0;
- {
- strcpy(game[0].name, "Life is strange");
- strcpy(game[0].genre[0], "Action");
- strcpy(game[0].genre[1], "Adventure");
- strcpy(game[0].platforms[0], "Linux");
- strcpy(game[0].platforms[1], "Microsoft Windows");
- strcpy(game[0].platforms[2], "OS X");
- strcpy(game[0].platforms[3], "PlayStation 3");
- strcpy(game[0].platforms[4], "PlayStation 4");
- strcpy(game[0].platforms[5], "Xbox 360");
- strcpy(game[0].platforms[6], "Xbox One");
- strcpy(game[0].languages[0], "English");
- strcpy(game[0].languages[1], "French");
- strcpy(game[0].languages[2], "Italian");
- strcpy(game[0].languages[3], "German");
- strcpy(game[0].languages[4], "Spanish");
- strcpy(game[0].languages[5], "Portuguese-Brazil");
- game[0].id = 1;
- game[0].price = 419;
- game[0].selling = 0;
- game[0].numbOfGenre = 2;
- game[0].numbOfLanguages = 6;
- game[0].numbOfPlatforms = 5;
- }
- {
- strcpy(game[1].name, "Valiant Hearts: The Great War");
- strcpy(game[1].genre[0], "Puzzle adventure");
- strcpy(game[1].platforms[0], "Android");
- strcpy(game[1].platforms[1], "iOS");
- strcpy(game[1].platforms[2], "Microsoft Windows");
- strcpy(game[1].platforms[3], "PlayStation 3");
- strcpy(game[1].platforms[4], "PlayStation 4");
- strcpy(game[1].platforms[5], "Xbox 360");
- strcpy(game[1].platforms[6], "Xbox One");
- strcpy(game[1].languages[0], "English");
- strcpy(game[1].languages[1], "French");
- strcpy(game[1].languages[2], "Italian");
- strcpy(game[1].languages[3], "German");
- strcpy(game[1].languages[4], "Spanish");
- strcpy(game[1].languages[5], "Dutch");
- strcpy(game[1].languages[6], "Japanese");
- strcpy(game[1].languages[7], "Polish");
- strcpy(game[1].languages[8], "Portuguese-Brazil");
- strcpy(game[1].languages[9], "Russian");
- game[1].id = 2;
- game[1].price = 699;
- game[1].selling = 0;
- game[1].numbOfGenre = 1;
- game[1].numbOfLanguages = 10;
- game[1].numbOfPlatforms = 7;
- }
- {
- strcpy(game[2].name, "Tomb Raider");
- strcpy(game[2].genre[0], "Action");
- strcpy(game[2].genre[1], "Adventure");
- strcpy(game[2].platforms[0], "Linux");
- strcpy(game[2].platforms[1], "Microsoft Windows");
- strcpy(game[2].platforms[2], "OS X");
- strcpy(game[2].platforms[3], "PlayStation 3");
- strcpy(game[2].platforms[4], "PlayStation 4");
- strcpy(game[2].platforms[5], "Xbox 360");
- strcpy(game[2].platforms[6], "Xbox One");
- strcpy(game[2].languages[0], "English");
- strcpy(game[2].languages[1], "French");
- strcpy(game[2].languages[2], "Italian");
- strcpy(game[2].languages[3], "German");
- strcpy(game[2].languages[4], "Spanish");
- strcpy(game[2].languages[5], "Dutch");
- strcpy(game[2].languages[6], "Korean");
- strcpy(game[2].languages[7], "Polish");
- strcpy(game[2].languages[8], "Portuguese-Brazil");
- strcpy(game[2].languages[9], "Russian");
- game[2].id = 3;
- game[2].price = 399;
- game[2].selling = 0;
- game[2].numbOfGenre = 2;
- game[2].numbOfLanguages = 10;
- game[2].numbOfPlatforms = 7;
- }
- {
- strcpy(game[3].name, "Watch_Dogs 2");
- strcpy(game[3].genre[0], "Action");
- strcpy(game[3].genre[1], "Adventure");
- strcpy(game[3].platforms[0], "Microsoft Windows");
- strcpy(game[3].platforms[1], "PlayStation 4");
- strcpy(game[3].platforms[2], "Xbox One");
- strcpy(game[3].languages[0], "English");
- strcpy(game[3].languages[1], "French");
- strcpy(game[3].languages[2], "Italian");
- strcpy(game[3].languages[3], "German");
- strcpy(game[3].languages[4], "Spanish");
- strcpy(game[3].languages[5], "Dutch");
- strcpy(game[3].languages[6], "Korean");
- strcpy(game[3].languages[7], "Polish");
- strcpy(game[3].languages[8], "Portuguese-Brazil");
- strcpy(game[3].languages[9], "Russian");
- game[3].id = 4;
- game[3].price = 1999;
- game[3].selling = 0;
- game[3].numbOfGenre = 2;
- game[3].numbOfLanguages = 10;
- game[3].numbOfPlatforms = 3;
- }
- {
- strcpy(game[4].name, "Mirror's Edge");
- strcpy(game[4].genre[0], "Action");
- strcpy(game[4].genre[1], "Adventure");
- strcpy(game[4].platforms[0], "iOS");
- strcpy(game[4].platforms[1], "Microsoft Windows");
- strcpy(game[4].platforms[2], "Windows Phone");
- strcpy(game[4].platforms[3], "PlayStation 3");
- strcpy(game[4].platforms[4], "Xbox 360");
- strcpy(game[4].languages[0], "English");
- strcpy(game[4].languages[1], "French");
- strcpy(game[4].languages[2], "Italian");
- strcpy(game[4].languages[3], "German");
- strcpy(game[4].languages[4], "Spanish");
- strcpy(game[4].languages[5], "Dutch");
- strcpy(game[4].languages[6], "Hungarian");
- strcpy(game[4].languages[7], "Polish");
- strcpy(game[4].languages[8], "Portuguese");
- strcpy(game[4].languages[9], "Russian");
- game[4].id = 5;
- game[4].price = 299;
- game[4].selling = 0;
- game[4].numbOfGenre = 2;
- game[4].numbOfLanguages = 10;
- game[4].numbOfPlatforms = 5;
- }
- {
- strcpy(game[5].name, "Fahrenheit: Indigo Prophecy Remastered");
- strcpy(game[5].genre[0], "RPG");
- strcpy(game[5].genre[1], "Adventure");
- strcpy(game[5].platforms[0], "Linux");
- strcpy(game[5].platforms[1], "Microsoft Windows");
- strcpy(game[5].platforms[2], "Android");
- strcpy(game[5].platforms[3], "iOS");
- strcpy(game[5].platforms[4], "PlayStation 4");
- strcpy(game[5].platforms[5], "OS X");
- strcpy(game[5].languages[0], "English");
- strcpy(game[5].languages[1], "French");
- strcpy(game[5].languages[2], "German");
- strcpy(game[5].languages[3], "Spanish");
- game[5].id = 6;
- game[5].price = 249;
- game[5].selling = 0;
- game[5].numbOfGenre = 2;
- game[5].numbOfLanguages = 4;
- game[5].numbOfPlatforms = 6;
- }
- {
- strcpy(game[6].name, "BioShock Infinite");
- strcpy(game[6].genre[0], "Action");
- strcpy(game[6].platforms[0], "Linux");
- strcpy(game[6].platforms[1], "Microsoft Windows");
- strcpy(game[6].platforms[2], "OS X");
- strcpy(game[6].platforms[3], "PlayStation 3");
- strcpy(game[6].platforms[4], "PlayStation 4");
- strcpy(game[6].platforms[5], "Xbox 360");
- strcpy(game[6].platforms[6], "Xbox One");
- strcpy(game[6].languages[0], "English");
- strcpy(game[6].languages[1], "French");
- strcpy(game[6].languages[2], "Italian");
- strcpy(game[6].languages[3], "German");
- strcpy(game[6].languages[4], "Spanish");
- strcpy(game[6].languages[5], "Japanese");
- strcpy(game[6].languages[6], "Korean");
- strcpy(game[6].languages[7], "Polish");
- strcpy(game[6].languages[8], "Portuguese-Brazil");
- strcpy(game[6].languages[9], "Russian");
- game[6].id = 7;
- game[6].price = 999;
- game[6].selling = 0;
- game[6].numbOfGenre = 1;
- game[6].numbOfLanguages = 10;
- game[6].numbOfPlatforms = 7;
- }
- {
- strcpy(game[7].name, "Amnesia: The Dark Descent");
- strcpy(game[7].genre[0], "Action");
- strcpy(game[7].genre[1], "Adventure");
- strcpy(game[7].genre[2], "Indie");
- strcpy(game[7].platforms[0], "Linux");
- strcpy(game[7].platforms[1], "Microsoft Windows");
- strcpy(game[7].platforms[2], "OS X");
- strcpy(game[7].platforms[3], "PlayStation 4");
- strcpy(game[7].languages[0], "English");
- strcpy(game[7].languages[1], "French");
- strcpy(game[7].languages[2], "Italian");
- strcpy(game[7].languages[3], "German");
- strcpy(game[7].languages[4], "Spanish");
- strcpy(game[7].languages[5], "Russian");
- game[7].id = 8;
- game[7].price = 499;
- game[7].selling = 0;
- game[7].numbOfGenre = 3;
- game[7].numbOfLanguages = 6;
- game[7].numbOfPlatforms = 4;
- }
- {
- strcpy(game[8].name, "Alan Wake");
- strcpy(game[8].genre[0], "Action");
- strcpy(game[8].genre[1], "Adventure");
- strcpy(game[8].platforms[0], "Microsoft Windows");
- strcpy(game[8].platforms[1], "Xbox 360");
- strcpy(game[8].languages[0], "English");
- strcpy(game[8].languages[1], "French");
- strcpy(game[8].languages[2], "Italian");
- strcpy(game[8].languages[3], "German");
- strcpy(game[8].languages[4], "Spanish");
- strcpy(game[8].languages[5], "Japanese");
- strcpy(game[8].languages[6], "Korean");
- strcpy(game[8].languages[7], "Polish");
- strcpy(game[8].languages[8], "Traditional Chinese");
- strcpy(game[8].languages[9], "Russian");
- game[8].id = 9;
- game[8].price = 499;
- game[8].selling = 0;
- game[8].numbOfGenre = 2;
- game[8].numbOfLanguages = 10;
- game[8].numbOfPlatforms = 2;
- }
- {
- strcpy(game[9].name, "Outlast");
- strcpy(game[9].genre[0], "Action");
- strcpy(game[9].genre[1], "Adventure");
- strcpy(game[9].genre[2], "Indie");
- strcpy(game[9].platforms[0], "Linux");
- strcpy(game[9].platforms[1], "Microsoft Windows");
- strcpy(game[9].platforms[2], "OS X");
- strcpy(game[9].platforms[3], "PlayStation 4");
- strcpy(game[9].platforms[4], "Xbox One");
- strcpy(game[9].languages[0], "English");
- strcpy(game[9].languages[1], "French");
- strcpy(game[9].languages[2], "Italian");
- strcpy(game[9].languages[3], "German");
- strcpy(game[9].languages[4], "Spanish");
- strcpy(game[9].languages[5], "Japanese");
- strcpy(game[9].languages[6], "Polish");
- strcpy(game[9].languages[7], "Portuguese-Brazil");
- strcpy(game[9].languages[8], "Russian");
- game[9].id = 10;
- game[9].price = 499;
- game[9].selling = 0;
- game[9].numbOfGenre = 3;
- game[9].numbOfLanguages = 9;
- game[9].numbOfPlatforms = 5;
- }
- {
- strcpy(seller[0].name, "Dmitry Ivanov");
- seller[0].selling = 0;
- }
- {
- strcpy(seller[1].name, "Ivan Kuznecov");
- seller[1].selling = 0;
- }
- {
- strcpy(seller[2].name, "Svetlana Pushkina");
- seller[2].selling = 0;
- }
- {
- strcpy(seller[3].name, "Irina Vorobyeva");
- seller[3].selling = 0;
- }
- {
- strcpy(seller[4].name, "Karina Kukushkina");
- seller[4].selling = 0;
- }
- {
- strcpy(buyer[0].name, "Evgenia Lipina");
- buyer[0].selling = 0;
- }
- {
- strcpy(buyer[1].name, "Mihail Ryabcov");
- buyer[1].selling = 0;
- }
- {
- strcpy(buyer[2].name, "Nikita Svetlokov");
- buyer[2].selling = 0;
- }
- {
- strcpy(buyer[3].name, "Artem Prostakov");
- buyer[3].selling = 0;
- }
- {
- strcpy(buyer[4].name, "Kirill Gorshkov");
- buyer[4].selling = 0;
- }
- printf("1 sdelat' pokupku\n");
- printf("2 pokazat' informaciu o tovare\n");
- printf("3 nayti prodavca s naibol'shimi prodagami\n");
- printf("4 nayti pokupatelya s bol'shim kolichestvom pokupok\n");
- printf("5 nayti naibolee prodavaemy tovar\n");
- printf("6 Informacia o prodagah\n");
- printf("7 exit\n");
- while(choice != 7)
- {
- printf("Chto nugno sdelat'?\n");
- scanf("%d", &choice);
- switch(choice)
- {
- case 1:
- {
- while(proverka == 0)
- {
- selling[schetchik].salesman = (struct sellers*) malloc(sizeof(struct sellers)*1);
- selling[schetchik].shopper = (struct buyers*) malloc(sizeof(struct buyers)*1);
- selling[schetchik].time = (struct data*) malloc(sizeof(struct data)*1);
- selling[schetchik].numbOfSoldGames = 0;
- printf("Vvedite imya i familiu prodavca\n");
- gets(selling[schetchik].salesman->name);
- for(i = 0; i < numbSellers; i++)
- {
- if (strcmp(selling[schetchik].salesman->name, seller[i].name)== 0)
- {
- seller[i].selling++;
- proverka = 1;
- break;
- }
- }
- if(proverka == 0)
- printf("Takogo prodavca net\n");
- }
- proverka = 0;
- while(proverka == 0)
- {
- printf("Vvedite imya i familiu pocupatelya\n");
- gets(selling[schetchik].shopper->name);
- for(i = 0; i < numbBuyers; i++)
- {
- if (strcmp(selling[schetchik].shopper->name, buyer[i].name)== 0)
- {
- buyer[i].selling++;
- proverka = 1;
- break;
- }
- }
- if(proverka == 0)
- printf("Takogo pocupatelya net\n");
- }
- proverka = 0;
- {
- while(choice1 == 1)
- {
- selling[schetchik].soldGame[selling[schetchik].numbOfSoldGames] = (struct games*) malloc(sizeof(struct games)*1);
- while(proverka == 0)
- {
- printf("Vvedite kod igry\n");
- scanf("%d", &selling[schetchik].soldGame[selling[schetchik].numbOfSoldGames]->id);
- for(i = 0; i < numbGames; i++)
- {
- if (selling[schetchik].soldGame[selling[schetchik].numbOfSoldGames]->id = game[i].id)
- {
- game[i].selling++;
- proverka = 1;
- break;
- }
- }
- if(proverka == 0)
- printf("Takoy igry net\n");
- }
- proverka = 0;
- selling[schetchik].numbOfSoldGames++;
- printf("Prodolgit'? 1 - Da, 2 - Net\n");
- scanf("%d", &choice1);
- }
- }
- printf("Vvedite datu pokupki\n");
- scanf("%d.%d.%d", &selling[schetchik].time->day, &selling[schetchik].time->month, &selling[schetchik].time->year);
- schetchik++;
- pokupka = 1;
- proverka = 0;
- }
- break;
- case 2:
- printf("Vvedite kod tovara\n");
- scanf("%d", &vvod);
- for(i = 0; i < numbGames; i++)
- {
- if (vvod == game[i].id)
- {
- printf("Nazvanye: %s\n", game[i].name);
- for(j = 0; j < game[i].numbOfGenre; j++)
- printf("Ganry: %s\n", game[i].genre[j]);
- for(j = 0; j < game[i].numbOfPlatforms; j++)
- printf("Platformy: %s\n", game[i].platforms[j]);
- for(j = 0; j < game[i].numbOfLanguages; j++)
- printf("Yazyki: %s\n", game[i].languages[j]);
- printf("Cena: %d\n", game[i].price);
- proverka = 1;
- break;
- }
- }
- if(proverka == 0)
- printf("Takoy igry net\n");
- proverka = 0;
- break;
- case 3:
- if(pokupka == 0)
- printf("Segodnya ne bylo ni odnoy prodagi\n");
- else
- {
- vvod = 0;
- for(i = 0; i < numbSellers; i++)
- {
- if ( seller[i].selling > vvod)
- {
- vvod = seller[i].selling;
- j = i;
- }
- }
- printf("Luchshiy prodavec: %s, kolichestvo prodag: %d\n", seller[j].name, seller[j].selling);
- }
- break;
- case 4:
- if(pokupka == 0)
- printf("Segodnya ne bylo ni odnoy prodagi\n");
- else
- {
- vvod = 0;
- for(i = 0; i < numbBuyers; i++)
- {
- if ( buyer[i].selling > vvod)
- {
- vvod = buyer[i].selling;
- j = i;
- }
- }
- printf("Pokupatel' s naibolshim kolichestvom pokupok: %s, kolichestvo pokupok: %d\n", buyer[j].name, buyer[j].selling);
- }
- break;
- case 5:
- if(pokupka == 0)
- printf("Segodnya ne bylo ni odnoy prodagi\n");
- else
- {
- vvod = 0;
- for(i = 0; i < numbGames; i++)
- {
- if ( game[i].selling > vvod)
- {
- vvod = game[i].selling;
- j = i;
- }
- }
- printf("Naibolee prodavaemy tovar: %s, kolichestvo prodag: %d\n", game[j].name, game[j].selling);
- }
- break;
- case 6:
- if(pokupka == 0)
- printf("Segodnya ne bylo ni odnoy prodagi\n");
- else
- {
- printf("Vvedite datu prodagi\n");
- scanf("%d.%d.%d", &dataProdagi.day, &dataProdagi.month, &dataProdagi.year);
- for(i = 0; i < schetchik; i++)
- {
- if((dataProdagi.day == selling[i].time->day) && (dataProdagi.month == selling[i].time->month) && (dataProdagi.year == selling[i].time->year))
- {
- printf("Prodavec: %s\n", selling[i].salesman->name);
- printf("Pokupatel': %s\n", selling[i].shopper->name);
- printf("Kuplennye igry:");
- for(j = 0; j < selling[i].numbOfSoldGames; j++)
- printf("%s\n", selling[i].soldGame[j]->name);
- }
- }
- }
- break;
- case 7:
- printf("Do svidanya\n");
- break;
- default:
- printf("Ne vybran ne odin punkt");
- }
- }
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement