【C语言学习笔记】1计算

https://www.icourse163.org/learn/ZJU-9001

编译、运行

程序框架 第一行代码 hello world

#include<stdio.h>
int main(){
    printf("hello world\n");   %f , 5.0 √    %f , 5 x
    return 0 ;
}

转移符号 \n

输入语句 scanf("%d",&a);     &        如果输入不是对应的值 会编程没有初始化的效果  %lf,&a

对变量需要初始化 (有可能对应地址有值)

const int Amount = 100; 常量定义

int 除法要用浮点数进行保存

10/3*3=10(整数之间的运算) 应当改为浮点数(/3.0)

%d ---> %f   double float

运算符+-、算子abc //  a*-b   a乘-b  // a=b=6 ->a=(b=6)

时间差的计算

调试

a++ vs ++a

猜你喜欢

转载自blog.csdn.net/kevin_nan/article/details/89879199