挥汗拜求大牛!一个小程序的调试,编译出错(devc++环境)
#include<stdio.h>#definePASSWORD"12345678"intverify_password(char*password){intauthen...
#include<stdio.h>
#define PASSWORD"12345678"
int verify_password(char *password)
{
int authentticated;
authentticated=strcmp(password,PASSWORD);
return authentticated;
}
main()
{
int valid_flag=0;
char password[1024];
while(1)
{
printf("please input password:");
scanf("%s",password);
valid_flag=verify_password(password);
if(valid_flag)
{
printf("incorrect password!\n\n");
}
else
{
printf("Yes!\n\n");
break;
}
}
}
以下是编译时出错信息:
2:17 C:\Users\Administrator\Desktop\新建文件夹\未命名1.cpp [Warning] ISO C requires whitespace after the macro name
C:\Users\Administrator\Desktop\新建文件夹\未命名1.cpp In function `int verify_password(char*)':
6 C:\Users\Administrator\Desktop\新建文件夹\未命名1.cpp `strcmp' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
不甚感激! 展开
#define PASSWORD"12345678"
int verify_password(char *password)
{
int authentticated;
authentticated=strcmp(password,PASSWORD);
return authentticated;
}
main()
{
int valid_flag=0;
char password[1024];
while(1)
{
printf("please input password:");
scanf("%s",password);
valid_flag=verify_password(password);
if(valid_flag)
{
printf("incorrect password!\n\n");
}
else
{
printf("Yes!\n\n");
break;
}
}
}
以下是编译时出错信息:
2:17 C:\Users\Administrator\Desktop\新建文件夹\未命名1.cpp [Warning] ISO C requires whitespace after the macro name
C:\Users\Administrator\Desktop\新建文件夹\未命名1.cpp In function `int verify_password(char*)':
6 C:\Users\Administrator\Desktop\新建文件夹\未命名1.cpp `strcmp' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
不甚感激! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询