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

学习总结

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

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

3、编程练习(题8):

 #include <stdio.h>
void Temperatures(double Fahrenheit);
const double c1=.8l;
const double c2=.0l;
const double c3=.16l;
int main(){
double frh;
while(){
printf("please enter Fahrenheit:");
scanf("%lf",&frh);
if(frh==){
break;
}
Temperatures(frh);
frh=;
}
printf("over!\n");
return ;
} void Temperatures(double f){
printf("Fahrenheit=%.2f\n",f);
printf("Celsius=%.2f\n",c1*f+c2);
printf("Kelvin=%.2f\n",c1*f+c2+c3);
}

运行结果:

please enter Fahrenheit:12

Fahrenheit=12.00

Celsius=53.60

Kelvin=326.76

please enter Fahrenheit:q

over!

上一篇:桥模式设计模式进入Bridge


下一篇:Error Code 1318 Incorrect number of arguments for PROCEDUR