请帮用C语言帮我编一个类似银行密码系统的程序..
来源:百度知道 编辑:UC知道 时间:2024/06/11 17:31:13
要求输入的密码用*掩盖.
#include"stdio.h"
#include"conio.h"
#include"string.h"
#define ID "15504"
#define PWD "password"
#define MAX_PWD_LEN 16
void main()
{
int i;
char ch;
char id[20];
char pwd[20];
printf("Input your ID:");
scanf("%s", id);
printf("Input your password:");
for (i = 0; i < MAX_PWD_LEN; i++) {
ch = (char)getch();
if (ch == 13)//return
break;
printf("*");
pwd[i] = ch;
}
pwd[i] = 0;
printf("\n");
if (strcmp(id, ID) != 0)
printf("Bad ID.\n");
else if(strcmp(pwd, PWD) != 0)
printf("Bad password.\n");
else
printf("Hello,%s.....\n", id);
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *p;
int i=0