自习教室管理系统

功能:(1)输入教室状态;(2)显示某天的自习教室;(3)修改教室状态

//自习教室管理系统

#include 
#define r 3//教室数
#define d 3//天数

int display(int a[][d]);//显示输入天数的空闲教室
int modify(int a[][d]);//修改某天某教室的状态

int main(void)
{
    int a[r][d];//行为教室,列为天数
    int i,j,t;//t为选择键
    
//    初始输入,1表示占用,0表示可自习
    printf("Input info.\n");
    for (i=0; i0)
        {
            break;
        }
        else
            printf("Please input the day between 0~%d.\n",d);
    }
    
//    输出当天空闲教室的号码
    for (i=0; i0)
        {
            break;
        }
        else
            printf("Please input the day between 0~%d.\n",d);
    }
//    教室输入
    printf("Input room.\n");
    while (1)
    {
        scanf("%d",&room);
        if (room<=r && room>0)
        {
            break;
        }
        else
            printf("Please input the room between 0~%d.\n",d);
    }
//     输出教室现在情况
    if (a[room][day])
    {
        printf("This room is occupied.\n");
    }
    else
        printf("This room is availabale.\n");
//      确定是否修改
    printf("Modify it,y or n?\n");
    getchar();
    if (getchar()=='y')
    {
        a[room-1][day-1] = !a[room-1][day-1];
    }
    
    return 0;
}

 

 

 

你可能感兴趣的:(C)