各位大神帮小弟看下 在c prime plus 上抄的 酒店收费那什么代码 不知道错误出在哪
#include<stdio.h>#define QUIT 5;
#define HOTEL1 80.00;
#define HOTEL2 125.00;
#define HOTEL3 155.00;
#define HOTEL4 200.00;
#define DISCOUNT 0.95;
#define STARS "***********************"
/*给出选项列数*/
int menu();
//返回预订的天数
int getnights();
//按饭店的星级和预订的天数计算价格并显示出来
void price(double,int);
void main()
{
int nights;
int code;
double hotel_rate;
while((code=menu()) != QUIT)//运行讲这一行错了error C2143: syntax error : missing ')' before ';'
{
switch(code)
{
case 1:hotel_rate=HOTEL1;
break;
case 2:hotel_rate=HOTEL2;
break;
case 3:hotel_rate=HOTEL3;
break;
case 4:hotel_rate=HOTEL4;
break;
default:hotel_rate=0.0;
printf("error");
break;
}
nights=getnights();
price(hotel_rate,nights);
}
printf("Thank you and goodbye");
}
/*hotel.c--旅馆管理函数*/
#include<stdio.h>
int menu()
{
int code,status;
printf("\n%s%s",STARS,STARS);
printf("Enter the number of the desired hotel:\n");
printf("1) Fairfield Arms 2) Hotel Olympic");
printf("3) Chertworthy Plaza 4) The Stockton");
printf("5) QUIT");
printf("%s%s",STARS,STARS);
while((status=scanf("%d",&code))!=1||(code<1||code>5))
{
scanf("%*s");
printf("Please enter a integer from 1 to 5.\n");
}
return code;
}
int getnights()
{
int nights;
printf("How many nights are needed?\n");
while(scanf("%d",&nights)!=1)
{
scanf("%*s");
printf("Please enter a integer,such as 2.\n");
}
return nights;
}
void price(double rate,int nights)
{
int n;
double total=0.0;
double factor=1.0;
for(n=1;n<=nights;n++,factor*=DISCOUNT)
{
total+=rate*factor;
}
printf("The total cost will be %0.2f.\n",total);
}