|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#include<string.h>
int main()
{
char password1[8] ;
char password2[8] ;
printf("请输入password1:");
scanf("password1[8] = %s",&password1[8]);
getchar();
printf("请再次输入password2:\n");
scanf("password2[8] = %s",&password2[8]);
getchar();
if(!strcmp(password1,password2))
{
printf("输入正确,正在登陆");
}
else
{
printf("输入错误,请重新输入");
}
return 0;
}
这个 我用Dev测,我不知道怎么改。。。。。getchar()不是可以过滤enter吗 为啥这个不行。好晕
scanf() 那块有错,帮你改好了
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char password1[8];
- char password2[8];
- printf("请输入password1:");
- scanf("%s", password1);
- getchar();
- printf("请再次输入password2:\n");
- scanf("%s", password2);
- getchar();
- if (!strcmp(password1, password2))
- {
- printf("输入正确,正在登陆");
- }
- else
- {
- printf("输入错误,请重新输入");
- }
- return 0;
- }
复制代码
|
|