用什么办法才能统计A1到D3剩下还有多少
void InitSeatTable()
{
char* seatNum[] =
{
"A1","A2","A3","B1","B2","B3",
"C1","C2","C3","D1","D2","D3"
};
for (int i = 0; i < SeatCount; i++)
{
strcpy(seats[i].seatID, seatNum[i]);
seats[i].IsAssigned = 0;
strcpy(seats[i].FirsName, "0");
strcpy(seats[i].LastName, "0");
}
}
//count empty seat
int EmptySeat()
{
char option = getchar();
if (option == 1)
{
printf("the number of empty seats is %d", SeatCount - 1);//这样好像不行
}
}
int getlen(char * seatNum)
{
int len = 0;
int posA1 = 0;
int posD3 = 0;
char * p =seatNum;
while(*p != '\0')
{
if(*p == 'A1')
{
posA1 = len;
}
if(*p == 'D3')
{
posD3 = len;
break;
}
len++;
p++;
}
if(posD3 == 0 || posA1 == 0)
{
return 0;
}
return (posD3 - posA1 - 1);
}