发布网友
共2个回答
热心网友
#include "stdarg.h"
#include "stdlib.h"
#include "stdio.h"
int number=0;
typedef struct myclass{
char *account;
char *password;
int num;
}mc;
char *inputpassword()
{int i;
char pass[50];
printf("\nplease input password:");
for (i=0;i<50;i++)
{pass[i]=getch();
if (pass[i]=='\r'|| pass[i]=='\n')
break;printf("*");}
return pass;
}
main()
{ mc mmclass[100];
char *username;
char key;
while(1)
{ printf("\n 1----create new account\n");
printf(" 2----quit");
printf("\n chooice:");
if ((key=getch())=='1')
{
printf("\nnplease input account:");
scanf("%s",username);
strcpy(mmclass[number].password,inputpassword());
strcpy(mmclass[number].account,username);
mmclass[number].num=0;
printf("\n created user success!!!");
number++;
printf("\n\n\n press anykey to continue");
getch();
}
else if (key=='2')
exit(0);
else
printf("\n\n input error");
}
}
热心网友
我写了,但是太常了,发布过来啊,,,我的可以,你用了再给我加分