zoukankan      html  css  js  c++  java
  • 【C语言学习】《C Primer Plus》第5章 运算符、表达式和语句

    学习总结

    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!
    ");
    18         return 0;
    19 }
    20 
    21 void Temperatures(double f){
    22         printf("Fahrenheit=%.2f
    ",f);
    23         printf("Celsius=%.2f
    ",c1*f+c2);
    24         printf("Kelvin=%.2f
    ",c1*f+c2+c3);
    25 }
    复制代码

    运行结果:

    please enter Fahrenheit:12

    Fahrenheit=12.00

    Celsius=53.60

    Kelvin=326.76

    please enter Fahrenheit:q

    over!

  • 相关阅读:
    数字和字母交替打印
    日期和字符串的转化
    redis简介
    管理MySQL的命令
    创建mysql数据表成功
    微信账号 echo_server 的实现
    html5 画个圈
    php练习1
    人生十大点
    养生“六伤”、“十二莫”、“十二少”
  • 原文地址:https://www.cnblogs.com/zhangyingai/p/7087392.html
Copyright © 2011-2022 走看看