c语言中while语句不执行,While 循环不运行,该如何处理

C/C++ code#include

struct info{

char name[20];

char email[30];

char tel[20];

char sex;

int x,x1,y1,z1,x2,y2,z2;

int balance;

char id[11];}client;

int main()

{

FILE *fp1,*fp2;

printf("Welcome to Sports Booking System registration!\n\n");

printf("After being a member of our system,\nyou can book the sports facilities at any time you like!!!\nIf you registrate now , you can a bonus of 30 dollars,\nSo come on !!!\n");

while(1)

{

printf("Please inpute the ID you want to use:");

scanf("%s",&client.id);

/*printf("%s",client.id);*/

if((fp1=fopen(client.id,"rb"))!=NULL)//至少这里有一个问题,运算符优先级

{

printf("The ID you inpute has already been used! Please choose another ID, sorry for the inconvenient!\n");

fclose(fp1);

}

else

{

printf("Please inpute your name:");

scanf("%s",&client.name);

/*printf("%s",client.name);*/

printf("Please inpute your email , so we can send you a email to confirm the booking after you booking the facilites ,\nand we can also remind you before the date you has booked! \nSo make sure that the email is correct!\n");

printf("Your email address:");

scanf("%s",&client.email);

/*printf("%s",client.email);*/

printf("Please inpute your telephone number , so we can contact you immediately if there is something emergency!\n");

printf("Your telephone number:");

scanf("%s",&client.tel);

/*printf("%s",client.tel);*/

printf("Please input your sex:");

fflush(stdin);

client.sex=getchar();

client.x=0;client.x1=6;client.y1=0;client.z1=0;client.x2=6;client.y2=0;client.z2=0;

client.balance=30;

fp2=fopen(client.id,"wb");

fwrite(&client,sizeof(struct info),1,fp2);

fclose(fp2);

printf("Thank you for complete registration.Now you can log in the booking system to book the facilities . Also you have already 30 dollors in your account.\n");

break;

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值