题目描述
编写一个密码检测程序,程序执行时,提示"Input password:“要求用户输入密码(标准密码预先设定为"hnkd2012”),然后通过字符串比较函数比较输入密码和标准密码是否相等。若相等,则显示“Congratulation!”;若不相等,则提示"Error,please input again:"重新输入,3次都不相等则提示"The program is terminated!"并终止程序的执行。要求自己编写一个字符串比较函数,而不使用系统的strcmp( )函数。
程序的一次运行情况如下(红色部分为键盘输入数据):
Input password:hnkd
Error,please input again:2012
Error,please input again:hnkd2012
Congratulation!
输入
如题
输出
如题
提示
本题由实验9实验范例1稍作改编而成。
难度系数为4
代码
#include <stdio.h>
#include<string.h>
int judge(char *s)
{
int f=