Created
November 21, 2013 00:30
-
-
Save pacharrin/7573872 to your computer and use it in GitHub Desktop.
My first ever school project written in c. it was supposed to be a ticketmaster-like vending system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
#include<ctype.h> | |
#include<string.h> | |
char teatro[25][80],fil,resp; | |
int i=0,j=0,sw=0,as,cont; | |
void main() | |
{ | |
strcpy(teatro[0] , " ___________________________________________________________________ "); | |
strcpy(teatro[1] , " | |_____| |_____| |"); | |
strcpy(teatro[2] , " | |"); | |
strcpy(teatro[3] , " | L[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[4] , " | K[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[5] , " | J[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[6] , " | I[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[7] , " | H[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[8] , " | G[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[9] , " | F[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[10] , " | E[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[11] , " | D[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[12] , " | C[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[13] , " | B[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[14] , " | A[ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ] |"); | |
strcpy(teatro[15] , " | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |"); | |
strcpy(teatro[16] , " | _______________________________________________________________ |"); | |
strcpy(teatro[17] , " | | | |"); | |
strcpy(teatro[18] , " | | | |"); | |
strcpy(teatro[19] , " | | | |"); | |
strcpy(teatro[20] , " | | | |"); | |
strcpy(teatro[21] , " | |_______________________________________________________________| |"); | |
strcpy(teatro[22] , " | |"); | |
strcpy(teatro[23] , " |___________________________________________________________________| "); | |
do{ | |
//clrscr(); | |
printf ("\n"); | |
cont=0; | |
j=0; | |
i=0; | |
do{ | |
puts(teatro[cont]); | |
cont++; | |
}while(cont<24); | |
printf("\n\nCompra de boletos:"); | |
printf("\nIngrese la fila: "); | |
do{ | |
do{ | |
sw=0; | |
fil=getche(); | |
sw=isalpha(fil); | |
fflush(stdin); | |
if(sw==0) | |
printf("\nTiene que ser una letra vuelve a ingresar: "); | |
}while(sw==0); | |
i=0; | |
if ((fil=='a') || (fil=='A')) | |
i=14; | |
else if ((fil=='b') || (fil=='B')) | |
i=13; | |
else if ((fil=='c') || (fil=='C')) | |
i=12; | |
else if ((fil=='d') || (fil=='D')) | |
i=11; | |
else if ((fil=='e') || (fil=='E')) | |
i=10; | |
else if ((fil=='f') || (fil=='F')) | |
i=9; | |
else if ((fil=='g') || (fil=='G')) | |
i=8; | |
else if ((fil=='h') || (fil=='H')) | |
i=7; | |
else if ((fil=='i') || (fil=='I')) | |
i=6; | |
else if ((fil=='j') || (fil=='J')) | |
i=5; | |
else if ((fil=='k') || (fil=='K')) | |
i=4; | |
else if ((fil=='l') || (fil=='L')) | |
i=3; | |
if (i==0) | |
printf("\nFila inexistente vuelve a ingresar: "); | |
}while(i==0); | |
printf("\n\nAsiento: "); | |
do{ | |
do{ | |
do{ | |
scanf("%d",&as); | |
if ((as<1) && (as>20)) | |
printf("\nAsiento invalida, vuelve a ingresar: "); | |
}while(as<1 && as>20); | |
j=0; | |
if (as>0 && as<12) | |
j=3+(as*3); | |
if (as>10 && as<21) | |
j=9+(as*3); | |
if(j==0){ | |
//textcolor(4); | |
printf("Tiene que ser una butaca existente vuelve a ingresar: "); | |
} | |
}while(j==0); | |
if (teatro[i][j]=='X') | |
printf("\nLo sentimos ese asiento esta ocupado, vuelva a seleccionar: "); | |
}while (teatro[i][j]=='X'); | |
teatro[i][j]='X'; | |
printf("\nDesea otro boleto(s/n)?"); | |
resp=getche(); | |
}while(resp=='s'); | |
getch(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment