c语言,校园核酸检测管理程序,由于vc++ 6.0缺少"stdbool.h"头文件,导致运行错误,如何不用该头文件实现程序目的?
#include
#include
#include
#include
#include
#include
#define MAX 1000000
const char *res[2] = {"阴性", "阳性"};
typedef struct SubjectToInspectionData{
char IdNumber[20];
char name[30];
char _tm[20];
char c; //2为待检测
}STID;
STID peo[MAX];
int count = 0;
void colors(int color)
{
switch(color)
{
case 1:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 1); //blue
break;
case 2:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4); //red
break;
case 3:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 2); //green
break;
case 4:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 9); //light blue
break;
case 5:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 5); //purple
break;
case 6:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 6); //yellow
break;
case 7:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14); //orange
break;
case 8:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);//white
break;
}
return;
}
void collecor()
{
int cun = 0;
colors(2);
printf("在任意提示语句后输入 exit 完成信息录入\n");
colors(8);
while(1)
{
printf("\n请输入身份证号:");
scanf("%s", &peo[cun].IdNumber);
if(strcmp(peo[cun].IdNumber, "exit") == 0)
break;
printf("输入待检者姓名:");
scanf("%s", &peo[cun].name);
getchar();//吃掉回车符
if(strcmp(peo[cun].name, "exit") == 0)
break;
//printf("是否获取当前时间:(y/n)");
printf("输入时间(yyyy-mm-dd hh:mm):");
scanf("%[^\n]s", peo[cun]._tm);
if(strcmp(peo[cun]._tm, "exit") == 0)
break;
peo[cun].c = '2';
cun++;
}
colors(1);
printf("收集完毕");
int i;
for(i = 0; i < 6; i++)
{
printf(".");
Sleep(150);
}
count = cun;
printf("\n");
system("pause");
system("cls");
colors(8);
}
void inspector()
{
int i;
char IdNum[20];
colors(2);
printf("在任意提示语句后输入 exit 完成信息录入\n");
colors(8);
while(1)
{
printf("请输入身份证号:");
scanf("%s", &IdNum);
if(strcmp(IdNum, "exit") == 0)
{
break;
}
for(i = 0; i < count; i++)
{
if(strcmp(peo[i].IdNumber, IdNum) == 0)
{
if(peo[i].c == '2')
{
colors(1);
printf("\n当前待检者没有检测结果\n");
colors(8);
printf("请输入检测结果(0为阴性,1为阳性):");
getchar();
scanf("%c", &peo[i].c);
printf("已录入\n");
}
else
{
if(peo[i].c == '0')
{
printf("%s(身份证号:%s) 的结果为:%s\n", peo[i].name, peo[i].IdNumber, res[0]);
}
else
{
printf("%s(身份证号:%s) 的结果为:%s\n", peo[i].name, peo[i].IdNumber, res[1]);
}
char _judge[10];
printf("是否需要修改结果:(y/n)");
scanf("%s", &_judge);
if(strcmp(_judge, "y") == 0 || strcmp(_judge, "Y") == 0)
{
printf("请输入检测结果(0为阴性,1为阳性):");
getchar();
scanf("%c", &peo[i].c);
}
}
}
}
}
system("pause");
return;
}
void sti()
{
int i;
char IdNum[20];
colors(2);
printf("在任意提示语句后输入 exit 以退出\n");
colors(8);
while(1)
{
printf("请输入身份证号:");
scanf("%s", &IdNum);
for(i = 0; i < count; i++)
{
if(strcmp(IdNum, peo[i].IdNumber) == 0)
{
int n = peo[i].c - '0';
printf("\n您的结果为:%s\n", res[n]);
}
}
}
return;
}
void admin()
{
char cho[2];
int j = 0, i;
printf("查询阴性输入1\n查询阳性输入2\n分类列出输入3\n");
scanf("%s", &cho);
if(cho[0] == '1')
{
for(i = 0; i < count; i++)
{
if(peo[i].c == '0')
{
printf("name: %s Id Number: %s %s\n", peo[i].name, peo[i].IdNumber, res[peo[i].c - '0']);
j++;
}
}
printf("\n共有%d人\n", j);
j = 0;
}
if(cho[0] == '2')
{
for(i = 0; i < count; i++)
{
if(peo[i].c == '1')
{
printf("name: %s Id Number: %s %s\n", peo[i].name, peo[i].IdNumber, res[peo[i].c - '0']);
j++;
}
}
printf("\n共有%d人\n", j);
j = 0;
}
if(cho[0] == '3')
{
for(i = 0; i < count; i++)
{
if(peo[i].c == '0')
{
printf("name: %s Id Number: %s %s\n", peo[i].name, peo[i].IdNumber, res[peo[i].c - '0']);
j++;
}
}
printf("\n共有%d人\n", j);
j = 0;
for(i = 0; i < count; i++)
{
if(peo[i].c == '1')
{
printf("name: %s Id Number: %s %s\n", peo[i].name, peo[i].IdNumber, res[peo[i].c - '0']);
j++;
}
}
printf("\n共有%d人\n", j);
j = 0;
for(i = 0; i < count; i++)
{
if(peo[i].c == '2')
{
printf("name: %s Id Number: %s 无检测结果\n", peo[i].name, peo[i].IdNumber);
j++;
}
}
printf("\n共有%d人\n", j);
j = 0;
}
return;
}
int main()
{
char _userIn[30]; //用户指令
while(1)
{
printf("采集员请输入:coll\n检测员请输入:Ins\n待检者请输入:STI(sti)\n输入 exit 退出程序\n");
printf("\nInstruction:");
scanf("%s", &_userIn);
system("cls");
if(strcmp(_userIn, "coll") == 0)
{
collecor();
}
if(strcmp(_userIn, "Ins") == 0)
{
inspector();
}
if(!strcmp(_userIn, "STI") || !strcmp(_userIn, "sti"))
{
sti();
}
if(strcmp(_userIn, "admin") == 0)
{
admin();
}
if(!strcmp(_userIn, "exit"))
{
break;
}
}
printf("\nend\n");
return 0;
}
把stdbool.h的#include语句删掉啊