#include
#include
#include
#include
void password()
{
char pwd[21]=""; //定义字符数组存储密码
char ch;
int i,j;
system("cls"); //清屏
for(i=1;i<=3;i++) //i控制密码输入的次数
{
printf("\n\t\t 请输入密码<您还有3次机会>:");
j=0;
while(j<20 && (ch=getch())!='\r')//'\r'表示回车符
{
pwd[j++]=ch;
putchar('*'); //在屏幕上回显"*"
}
pwd[j]='\0'; //添加字符串结束标志'\0'
if(strcmp(pwd,"123456")==0)//密码正确的情况
{
system("cls");
printf("\n\t\t 欢迎使用学生成绩统计系统!\n");
getch(); //屏幕暂停,按任意键继续
break;
}
else
printf("\n\t\t 密码错误!\n");
}
if(i>3)
{
printf("\n\t\t 密码输入已达3次,您无权使用该系统,请退出!\n");
exit(0);
}
return;
}
出现以下错误
1.undefined reference to `WinMain'
2.[Error] ld returned 1 exit status
我用的是Dev C++编译器