码迷,mamicode.com
首页 > 编程语言 > 详细

【C语言学习】《C Primer Plus》第5章 运算符、表达式和语句

时间:2017-06-27 23:38:19      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:type   turn   练习   res   include   函数   img   bsp   can   

 

学习总结

 

1、有了一定的语言基础,运算符和表达式这些都大同小异,无外乎赋值运算符(=)、算术运算符(+、-、*、/、%、++、——)和其他的一下运算符(sizeof、(type))。

 

2、声明一个参数就创建了一个被称为形式参数(formal argument)或形式参量(formal parameter)。我们称函数调用传递一个值,这个值被称为实际参数(actual argument)或实际参量(actual parameter)。

 

3、编程练习(题8):

技术分享
 1 #include <stdio.h>
 2 void Temperatures(double Fahrenheit);
 3 const double c1=1.8l;
 4 const double c2=32.0l;
 5 const double c3=273.16l;
 6 int main(){
 7         double frh;
 8         while(1){
 9                 printf("please enter Fahrenheit:");
10                 scanf("%lf",&frh);
11                 if(frh==0){
12                         break;
13                 }
14                 Temperatures(frh);
15                 frh=0;
16         }
17         printf("over!\n");
18         return 0;
19 }
20 
21 void Temperatures(double f){
22         printf("Fahrenheit=%.2f\n",f);
23         printf("Celsius=%.2f\n",c1*f+c2);
24         printf("Kelvin=%.2f\n",c1*f+c2+c3);
25 }
技术分享

运行结果:

please enter Fahrenheit:12

Fahrenheit=12.00

Celsius=53.60

Kelvin=326.76

please enter Fahrenheit:q

over!

【C语言学习】《C Primer Plus》第5章 运算符、表达式和语句

标签:type   turn   练习   res   include   函数   img   bsp   can   

原文地址:http://www.cnblogs.com/zhangyingai/p/7087392.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!