第一章--简单的计算程序

 

一:第一个c程序案例

1:第一个c程序

 

#include <stdio.h>
int main()框架

{spa

printf("hello world");blog

return 0;ci

}字符串

 

编译、运行:io

  

结果:编译

  

 

2:程序框架

#include <stdio.h>table

 

int main()class

{程序

 

return 0;

}

注意:要有分号奥

不要用中文(字符串外的符合要英文字符)

3:输出

 

printf("hello world\n");

 

(1“”里面的内容叫作字符串

printf会把字符串原封不动的输出

(2)\n表示在输出结果后面换行

 4:输入

scanf("%d",&price);

二:作计算

1:%d

printf("%d",12+3)

 

---->%d说明后面有一个整数要输出在%d的位置上

2:四则运算

 

四则运算

c符合

意义

+

+

   

x

*

 

/

 

%

取余

()

()

括号

相关文章
相关标签/搜索