Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "dress_header.h"
- //Программа шифрующая информацию о платье в бинарный фаил.
- void main(){
- puts("Zdravstvuite. Eto registratsiya platiya");
- puts("Nazhmite chto-to\n1 - pomosh\n2 - sozdanie platiya\n3 - prosmotr platiya\n0 - vihod");
- char doing = getch();
- while(doing != 0){
- switch(doing){
- case '1': user_help(); break;
- case '2': FILE * my_dress = create_dress(); break;
- }}}
- FILE * create_dress(){
- dress shmotka;
- char check;
- int i;
- puts("Vvedite imya platiya");
- gets(shmotka.dress_name);
- FILE * dressfile = fopen(strcat(shmotka.dress_name, ".bin"), "wr+");
- puts("Shifr tsveta:");
- check = getch();
- switch(check){
- case '1': shmotka.colour = 1; break;
- case '0': shmotka.colour = 0; break;}
- puts("Shifr pola");
- check = getch();
- switch(check){
- case '1': shmotka.colour = 1; break;
- case '0': shmotka.colour = 0; break;}
- puts("Shifr ceni:");
- switch(check){
- case '1': shmotka.colour = 1; break;
- case '0': shmotka.colour = 0; break;}
- puts("Shifr razmera:");
- switch(check){
- case '1': shmotka.colour = 1; break;
- case '0': shmotka.colour = 0; break;}
- puts("Shifr kachestva:");
- char check_you[3];
- for(i = 0; i < 3; i++){
- check_you[i] = getch();
- }
- if(strcmp(check_you, "000") == 0){
- shmotka.kachestvo = 000;}
- else if(strcmp(check_you, "001") == 0){
- shmotka.kachestvo = 001;}
- else if(strcmp(check_you, "010") == 0){
- shmotka.kachestvo = 010;}
- else if(strcmp(check_you, "011") == 0){
- shmotka.kachestvo = 011;}
- else if(strcmp(check_you, "100") == 0){
- shmotka.kachestvo = 100;}
- fwrite(&shmotka, sizeof(dress), sizeof(shmotka), dressfile);
- return dressfile;}
- void user_help(){
- puts("Tsvet: 0 - sinie, 1 - zheltee");
- puts("Pol: 0 - muzhchina, 1 -zhenchina");
- puts("Cena: 0 - deshevoe, 1 - dorogoe");
- puts("Razmer: 0 - malenkoe, 1 - bolsoe");
- puts("Kachestvo: 000 - och plohoe, 001 - plohoe, 010 - tak sebe, 011 - horoshee, 100 - prekrasnoe");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement