C语言作业题,再请各位帮忙!

yappies 2007-11-12 09:23:24
1. 修改如下程序,将华氏温度转换为摄氏温度。
/*
* File:c2ftable.c
*---------------
*This program illustrates the use of runctions by generating
*a table of Celsius to Fahrenheit convesions.
*/
# include <stdio.h>
# include”genlib.h”

/*
*constants
*---------------
*LowerLimit -- Starting value for temperature table
*UpperLimit -- Final value for temperature table
*StepSize --Step size between table entries
*/

#define LowerLimit 0
#define UpperLimit 100
#define StepSize 5
/* Function Prototypes*/
double CelsiusToFahrenheit (double c);
/* Main program */
main( )

int c;
printf (“Celsius to Fahrenheit table.\n”);
prinft (“C F\n”);
for (c=LowerLimit; c<=UpperLimit; c+=StepSize)
printf (“%3d %3g\n , c, CelsiusToFahrenheit (c));



/*
* Function:CelsiusToFahrenheit
* Usage: f=CelsiusToFahrenheit(c);
*----------------------------------------
* This function returns Fahrenheit equivalent of the Celsius
* temperature C.
*/
double Celsius ToFahrenheit(double c)

return ( 9.0 / 5.0 * c + 32 ) ;



按如下运行示例的输出格式输出
Fahrenheit to Celsius table.
F C
32 0.0
34 1.1

98 36.7
100 37.8
...全文
204 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
xugang_2001 2007-11-13
  • 打赏
  • 举报
回复
哈哈 楼上的石头兄和循环兄很幽默
kojie_chen 2007-11-12
  • 打赏
  • 举报
回复
.........哎.
loops 2007-11-12
  • 打赏
  • 举报
回复
我决定等你们升星了,对分数没有欲望了,我再来慢慢的抢分。
_石头_ 2007-11-12
  • 打赏
  • 举报
回复
哎呀!...这....这,哎,等得太久了! 50分阿,就这样被竹子拿走了!
thecorr 2007-11-12
  • 打赏
  • 举报
回复
看能不能给点分
justju 2007-11-12
  • 打赏
  • 举报
回复
只好接分
xugang_2001 2007-11-12
  • 打赏
  • 举报
回复
为了接分,我冒着被1楼骂得危险给你修改了程序,在VS2005下编译通过且可以运行,但是对程序内容没有任何修改:


/* 
* File:c2ftable.c
*---------------
*This program illustrates the use of runctions by generating
*a table of Celsius to Fahrenheit convesions.
*/
# include <stdio.h>
//# include "genlib.h"

/*
*constants
*---------------
*LowerLimit -- Starting value for temperature table
*UpperLimit -- Final value for temperature table
*StepSize --Step size between table entries
*/

#define LowerLimit 0
#define UpperLimit 100
#define StepSize 5
/* Function Prototypes*/
double CelsiusToFahrenheit (double c);
/* Main program */
int main( )
{
int c;
printf ("Celsius to Fahrenheit table.\n");
printf ("C F\n");
for (c=LowerLimit; c <=UpperLimit; c+=StepSize)
{
printf ("%3d %4f\n" , c, CelsiusToFahrenheit (c));
}

system("pause");
return 0;
}



/*
* Function:CelsiusToFahrenheit
* Usage: f=CelsiusToFahrenheit(c);
*----------------------------------------
* This function returns Fahrenheit equivalent of the Celsius
* temperature C.
*/
double CelsiusToFahrenheit(double c)
{
return ( (9.0 / 5.0) * c + 32 ) ;
}
mikster 2007-11-12
  • 打赏
  • 举报
回复
dont be silly.
_石头_ 2007-11-12
  • 打赏
  • 举报
回复
建议搂住先自己尝试着写一写,我们直接给出结论来会被论坛的兄弟们鄙视的----虽然你给的分有很大的诱惑力,咳...咳,我还是先等等!

69,371

社区成员

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

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