C primer plus 中usehotel的例子,求解?
这是hotel.c中的代码:
#include<stdio.h>
#include "hotel.h"
#define STARS *******************
int menu(void)
{
int code, status;
printf("\n%s%s\n", STARS, STARS);
printf("Enter the number of the desired hotel: \n");
printf("1) Fairfied Arms 2) Hotel Olympic\n");
printf("3) Chertowrthy Plaza 4) The Stockton\n");
printf("5) quit\n");
printf("%s%s\n", STARS, STARS);
while( (status = scanf("%d", &code)) != 1
|| (code < 1 || code > 5))
{
if(status != 1) {
//scanf("%*s", "");
printf("Enter an integer from 1 to 5, please.\n");
}
}
return code;
}
int getnights(void)
{
int nights;
return nights;
}
void showprice(double rate, int nights)
{
int n;
double total = 0.0;
double factor = 1.0;
printf("The total cost will be $%0.2f.\n", total);
}
#include<stdio.h>
#include "hotel.h"
#define STARS *******************
int menu(void)
{
int code, status;
printf("\n%s%s\n", "*******************", "*******************");
printf("Enter the number of the desired hotel: \n");
printf("1) Fairfied Arms 2) Hotel Olympic\n");
printf("3) Chertowrthy Plaza 4) The Stockton\n");
printf("5) quit\n");
printf("%s%s\n", "*******************", "*******************");
while( (status = scanf("%d", &code)) != 1
|| (code < 1 || code > 5))
{
if(status != 1) {
//scanf("%*s", "");
printf("Enter an integer from 1 to 5, please.\n");
}
}
return code;
}
int getnights(void)
{
int nights;
return nights;
}
void showprice(double rate, int nights)
{
int n;
double total = 0.0;
double factor = 1.0;
printf("The total cost will be $%0.2f.\n", total);
}