C编程 输入密码的问题

来源:百度知道 编辑:UC知道 时间:2024/05/07 23:45:11
输入用户登陆密码(你名字全拼组成的字符串),重复输入进行确认。如两次输入的内容相同(使用strcmp函数),则输出密码+学号(使用strcat函数),如两次输入的内容不同,则输出不能登陆等信息

#include <stdio.h>
void main()
{
char str0[15],str1[15],str2[15];
printf("Please input the name:");
gets(str0);
printf("Please input the password:");
gets(str1);
printf("Please input the password again:");
gets(str2);
if(strcmp(str1,str2)==0)
printf("%s",strcat(str1,str0));
else
printf("It can't load.");
}

你这个程序是不是自己用的,是的话建义你事先就存有密码,然后启动程序的时候要求输入密码,只要和你事先存的相同就能登陆,不同返回再次输入,但是允许输入的次数由自己确定,如果对的话就输出什么内容。如果这样的话请回答。不是的话没多大现实意义。不如直接说比较两个字符串。Q:373765724