zoukankan      html  css  js  c++  java
  • 【C语言学习】《C Primer Plus》第3章 数据和C

    学习总结

    1、C基本数据类型使用11个关键字:int、long、short、unsigned、char、float、double、signed、_Bool、_Complex和_Imaginary。

    2、在标准C中,整数0就是false,大于0的整数都为true。char其实也是可以是以整数打印。

    3、八进制以0为前缀表示、十六进制以0x或0X表示。

    4、可以用过sizeof关键字查询类型的长度,如果sizeof(int)。C99出现了可移植类型(inttype.h):int16_t、unint32_t等,主要还是为了代码的可移植性。

    5、编程练习(题7):

    复制代码
     1 #include <stdio.h>
     2 
     3 int main(void){
     4         char type;
     5         double height;
     6 
     7         printf("please choose changeType(f/c):");
     8         scanf("%c",&type);
     9         if(type=='f'){
    10                 printf("please enter your height(cm):");
    11                 scanf("%lf",&height);
    12                 printf("your height is %.2f ft.
    ",height/2.4);
    13         }else if(type=='c'){
    14                 printf("please enter your height(ft):");
    15                 scanf("%lf",&height);
    16                 printf("your height is %.2f cm.
    ",height*2.4);
    17         }else{
    18                 printf("wrong type!
    ");
    19         }
    20 }
    复制代码
  • 相关阅读:
    apicloud教程
    apicloud教程3 (转载)
    apicloud教程2 (转载)
    apicloud教程1 (转载)
    API CLOUD 快捷键
    JS IIFE写法
    php事件驱动
    JQuery实践--Why JQuery
    Jquery实践--精读开篇
    python 实践--新闻聚合
  • 原文地址:https://www.cnblogs.com/zhangyingai/p/7087394.html
Copyright © 2011-2022 走看看