#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[])
{
FILE *fp=fopen("./user.txt","a+");
if(NULL==fp){
return -1;
}
char name[20];
char password[20];
char fname[20];
char fpassword[20];
scanf("%s%s",name,password);
while(fscanf(fp,"%s %s",fname,fpassword)>0){
if(strcmp(name,fname)==0){
printf("该用户存在\n");
return -2;
}
}
fprintf(fp,"%s %s",name,password);
fclose(fp);
return 0;
}