多源代码文件程序的编译,新手求教,急急!!!

LL1376259328 2016-11-09 05:25:37
怎么将下面的代码联系到一起编译啊?
#include<stdio.h>
#include "hotel.h"
int main(void)
{
int nights;
double hotel_rate;
int code;

while((code = menu())!= QUIT)
{
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("Oops!\n");
break;
}
nights = getnights();
showprice(hotel_rate,nights);
}
printf("Thank you and goodbye.\n");
return 0;
}


#include<stdio.h>
#include"hotel.h"
int menu(void)
{
int code,status;
printf("\n%s%s\n",STARS,STARS);
printf("enter the number of the desired hotel:\n");
printf("1) Fairfiled Arms 2) Hotel olmypic\n");
printf("3) Chertworthy Plaza 4)The stockton\n");
printf("5) quit \n");
printf("%s%s\n",START,START);
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;
}


hotal.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 START "********************"
...全文
171 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
paschen 2016-11-10
  • 打赏
  • 举报
回复
通常有个IDE的话直接添加到IDE新建的项目里即可
LL1376259328 2016-11-09
  • 打赏
  • 举报
回复
已经好了,谢谢
eastfriendwu 2016-11-09
  • 打赏
  • 举报
回复
类似这样: gcc -g -Wall -o test xx1.c xx2.c xx3.c
小灸舞 版主 2016-11-09
  • 打赏
  • 举报
回复
1.如果是用的是IDE,比如VS之类的 将文件添加到工程中,然后点运行就行 2.GCC手动编译链接:http://www.cnblogs.com/hdchild/archive/2009/11/07/1598178.html

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧