C - The C Answer (2nd Edition) - Exercise 1-15
/* Rewrite the temperature conversion program of Section 1.2 to use a function for conversion. */ #include <stdio.h> float celsius(float fahr); /* print Fahrenheit-Celsius table or fahr = 0, 20, ..., 300; floating-point version */
main()
{
float fahr;
int lower, upper, step;
lower = 0; /* lower limit of temperature table */
upper = 300; /* upper limit */
step = 20; /* step size */
fahr = lower;
while(fahr <= upper)
{
printf("%3.0f %6.1f\n", fahr, celsius(fahr));
fahr += step;
}
} /* celsius: convert fahr into celsius */
float celsius(float fahr)
{
return (5.0 / 9.0) * (fahr - 32.0);
}
C - The C Answer (2nd Edition) - Exercise 1-15的更多相关文章
- C - The C Answer (2nd Edition) - Exercise 1-7
/* Write a program to print the value of EOF. */ #include <stdio.h> main() { printf("EOF ...
- C - The C Answer (2nd Edition) - Exercise 1-2
/* Experiment to find out what happens when printf's argument string contains \c, where c is some ch ...
- C - The C Answer (2nd Edition) - Exercise 1-1
/* Run the "hello, world" program on your system. Experiment with leaving out parts of the ...
- C - The C Answer (2nd Edition) - Exercise 1-16
/* Revise the main routine of the longest-line program so it will correctly print the length of arbi ...
- C - The C Answer (2nd Edition) - Exercise 1-8
/* Write a program to count blanks, tabs, and newlines. */ #include <stdio.h> /* count blanks, ...
- C - The C Answer (2nd Edition) - Exercise 1-5
/* Modify the temperature conversion program to print the table in reverse order, that is, from 300 ...
- C - The C Answer (2nd Edition) - Exercise 1-12
/* Write a program that prints its input one word per line. */ #include <stdio.h> #define IN 1 ...
- C - The C Answer (2nd Edition) - Exercise 1-4
/* Write a program to print the corresponding Celsius to Fahrenheit table. */ #include <stdio.h&g ...
- C - The C Answer (2nd Edition) - Exercise 1-6
/* Verify that the expression getchar() != EOF is 0 or 1. */ #include <stdio.h> main() { int c ...
随机推荐
- Concurrent control in SQLite
This document describes the technologies to concurrent access to a SQLite database. There are also s ...
- 2星|《约见投资人》:A股上市公司软文集
约见资本人:58家上市公司创始人亲述创业之路 全书写了58个A股上市公司的故事,基本是宣传上市公司老总的软文.基本的套路是创始人历尽苦难创立了公司,取得了好业绩.最希望看的分析与数据几乎没有.看了一小 ...
- 用 webpack 实现持久化缓存
什么是持久化缓存? 原文链接https://sebastianblade.com/using-webpack-to-achieve-long-term-cache/ 缓存(cache)一直是前端性能优 ...
- centos7服务器安装fail2ban配合Firewalld防护墙防止SSH爆破与防护网站CC攻击
centos7服务器安装fail2ban配合Firewalld防护墙防止SSH爆破与防护网站CC攻击 1.检查firewalld是否启用 #如果您已经安装iptables建议先关闭 service i ...
- CAD得到所有实体方法(网页版)
主要用到函数说明: IMxDrawSelectionSet::AllSelect 得到当前空间的所有实体.详细说明如下: 参数 说明 [in,defaultvalue(NULL)] IMxDrawRe ...
- 操作Session存储对象时的一些问题
前段时间在操作Session存储的对象时,遇到了类似以下的这种情况: User user=new User("张三"); //创建一个姓名为“张三”的User对象 Session[ ...
- (1) GoJS入门
GoJS的官方下载,若下载失败,可尝试通过我的个人网盘分享下载. GoJS是一款功能强大,快速且轻量级的流程图控件,可帮助你在JavaScript 和HTML5 Canvas程序中创建流程图,且极大地 ...
- NOIP2000方格取数(洛谷,动态规划递推)
先上题目: P1004 方格取数 下面上ac代码: ///如果先走第一个再走第二个不可控因素太多 #include<bits/stdc++.h> #define ll long long ...
- 09js、MySQL相关
09js.MySQL相关-2018/07/19 1.js的dom 理解一下文档对象模型:html文件加载到内存之后会形成一颗dom树,根据这些节点对象可以进行脚本代码的动态修改;在dom树当中 一切皆 ...
- IntelliJ IDEA 环境设置——侧栏显示类中所有方法
myeclipse默认会在右侧栏显示类的所有方法框,但是IDEA里并没有这样的初始化设置 那么怎样显示这个功能? 1.点击工具栏View-->Tool Windows-->Structur ...