Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <time.h>
- #include <stdlib.h>
- #include <math.h>
- int sindesi (char on[20],char kod[20]);
- int x;
- char user[20];
- char pass[20];
- char movie [20];
- int date=0;
- int room= (rand()%20 ) + 1;
- int room1=0;
- int i;
- int seats=0;
- int apth=5;
- int apad (void);
- int thesi=0;
- int kathismata[100];
- int j;
- int thesi2=0;
- int thesi3= (rand()%100 ) + 1;
- int poso=0;
- int main ()
- {
- for ( j = 99 ; j >= 0; j--)
- {
- kathismata[j]=j+1;
- }
- do
- {
- printf ("username:\n");
- scanf (" %s", &user);
- printf ("password:\n");
- scanf (" %s", &pass);
- x=sindesi (user,pass);
- }
- while (x==0);
- printf ("oi diathesimes tainies einai:\n");
- printf ("i) Home Alone 3\nii) Ted 2\niii) Star wars episode 1\niv) Harry Potter 4\n");
- do
- {
- printf ("poia tainia epithimite na deite? grpase th prwth le3h tis tainias poy epithimite etsi akrivws opws emfanizetai stin othoni\n");
- scanf (" %s", &movie);
- }
- while ((strcmp(movie, "Home") == 1 ) && (strcmp(movie, "Ted") == 1 ) && (strcmp(movie, "Star") == 1 ) && (strcmp(movie, "Harry") == 1 ));
- do
- {
- printf ("poia mera epithimete na deite th tainia?\n");
- scanf (" %d", &date);
- }
- while ((date<0) || (date>24));
- printf ("\n\nh tainia tha provlithei sthn aithousa %d\n", room);
- printf ("epanalavete thn aithousa gia epivevaiwsh:\n");
- scanf (" %d", &room1);
- do
- {
- printf ("lathos aithousa, 3anaprospathieste:\n");
- scanf (" %d", &room1);
- }
- while (room1!=room);
- system("cls");
- printf ("oi diathesimes theseis einai:\n\n");
- for ( i = 100 ; i >0 ; i-- )
- {
- if (i==80)
- {
- printf ("\n\t");
- }
- if (i==65)
- {
- printf ("\n\t");
- }
- if (i==50)
- {
- printf ("\n\t");
- }
- if (i==35)
- {
- printf ("\n\t");
- }
- if (i==20)
- {
- printf ("\n\t\t");
- }
- if (i==10)
- {
- printf ("\n\t\t\t");
- }
- printf (" %d", i);
- }
- printf ("\nposes theseis thelete na krathsete?\n");
- scanf (" %d", &seats);
- while ((seats<0) || (seats>2))
- {
- printf ("de boreite na krathsete panw apo 2 theseis\ndwste egiro arithmo thesewn\n");
- scanf (" %d", &seats);
- }
- apth=apad ();
- while (apth==0)
- {
- apth=apad ();
- }
- if (apth==2)
- {
- if (seats==1)
- {
- printf ("se poia thesi epithimite na katsete?\n");
- scanf (" %d", &thesi);
- while ((thesi<1) || (thesi>100))
- {
- printf ("mi egiros arithos thesis, prospathiste 3ana\n");
- scanf (" %d", &thesi);
- }
- system ("cls");
- kathismata[thesi - 1 ]=0;
- printf ("seat is: %d\n", thesi);
- for ( j = 99 ; j >= 0; j--)
- {
- printf (" %d", kathismata[j]);
- }
- }
- else
- {
- printf ("se poia thesi epithimite na katsete?\n");
- scanf (" %d", &thesi);
- printf ("se poai thesi epithimite na katsei to allo atomo poy einai amzi sas\n");
- scanf (" %d", &thesi2);
- int k=thesi-thesi2;
- while ((k < -1) || (k > 1))
- {
- printf ("oi theseis poy dwsate den einai dipla h mia sthn allh, 3anadwste th prwth thesi\n");
- scanf (" %d", &thesi);
- printf ("3anadwste kai th deuterh thesi\n");
- scanf (" %d", &thesi2);
- }
- system ("cls");
- kathismata [thesi - 1]=0;
- kathismata [thesi - 2]=0;
- printf ("seats are: %d, %d", thesi, thesi2);
- for ( j = 99 ; j >= 0; j--)
- {
- printf (" %d", kathismata[j]);
- }
- }
- }
- else
- {
- if (seats==1)
- {
- system ("cls");
- kathismata[thesi3 - 1 ]=0;
- printf ("seat is: %d\n", thesi3);
- for ( j = 99 ; j >= 0; j--)
- {
- printf (" %d", kathismata[j]);
- }
- }
- else
- {
- system ("cls");
- kathismata [thesi3 - 1]=0;
- kathismata [thesi3]=0;
- int l=thesi3+1;
- printf ("seats are: %d, %d", thesi3, l);
- for ( j = 99 ; j >= 0; j--)
- {
- printf (" %d", kathismata[j]);
- }
- }
- }
- if (seats==1)
- {
- poso=10;
- }
- if (seats==2)
- {
- poso=15;
- }
- return 0;
- }
- int sindesi (char on[20], char kod[20])
- {
- if ((strcmp(on, "movie") ==0 ) && (strcmp(kod, "mo") ==0 ))
- {
- return 1;
- }
- else
- {
- printf ("wrong data, try again\n");
- return 0;
- }
- }
- int apad (void)
- {
- int k=5;
- char ap[2];
- printf ("pws thete na kratithoun oi theseis? pieste X gia xeirokinhta h A gia aytomata");
- scanf (" %s", &ap);
- if ((strcmp(ap, "A") ==0 ))
- {
- k=1;
- return 1;
- }
- if ((strcmp(ap, "X") ==0 ))
- {
- k=2;
- return 2;
- }
- if (k==5)
- {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement