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 }
  • 相关阅读:
    d
    今天刚注册,测试下
    关于Hadoop的简单介绍
    leveldb 阅读笔记 (2) 简易测试框架
    leveldb 阅读笔记(1) 内存分配器 Arena
    数论
    伴随网站
    convenience website
    大佬独特的骗分技巧
    动态规划
  • 原文地址:https://www.cnblogs.com/wcd144140/p/4511186.html
Copyright © 2011-2022 走看看