0
I need the user to enter where he wants to sit by informing the row and column he wants, if the user chooses the position 0-1 the program will register and write to a txt file later mind that information, and will enter a looping to register a new user, where he will type what position he wants and if he type a position where it is already occupied by another user the program will not accept putting a X in place to demonstrate that it is occupied.
Follows the code...
#include<stdio.h>
#include <stdlib.h>
void main()
{
printf("\n \nEscolha seu assento: \n\n");
int m, n, fileira, assento;
int lugares[10][16];
for(m=1;m<10;m++){
for(n=1;n<16;n++){
printf("[%d- %d]", m, n);
}
printf("\n");
}
printf("\nFileira desejada: ");
scanf("%d",&fileira);
printf("Assento desejado: ");
scanf("%d",&assento);
system("pause");
}
Since you use values 0 and 1, it makes no sense to use an integer. You could use an
bool
beingtrue
busy andfalse
no. The loop should start from 0 also instead of 1 as it is doing.– Kevin Kouketsu