用到的专业词汇
stdio.h(standard buffered input & output)带缓冲的标准输入输出
sourse file 源文件(原始程序)
comment 注释
dignostic message 诊断消息
printf (print format) 格式化输出函数
function call 函数调用
decimal 十进制%d
statement 语句
format string 格式化字符串
conversion specification 转换说明
string literal 字符串常量
escape sequence 转义字符
declaration 声明
constant 常量
integer 整数类型int
initialize 初始化
1、程序中的空格不能用全角格式,全角字符占2个字节,半角占1个字节
2、写程序写上注释,方便他人快速读懂
3、printf ();也是一个函数调用
4、\n反斜线+n,/ 除法
5、要想变量先进行类型声明
6、puts()函数实参只有一个,就是字符串,不可进行格式的设定和数值的输出,会自动输入换行符
7、写程序应如下标准
/*
计算长方形的面积
*/
#include <stdio.h>
int main ()
{
int width;
int height;
int area;//声明变量
puts("请输入长方形的宽:");//给变量赋值
scanf("%d",&width);
puts("请输入长方形的高:");
scanf("%d",&height);
area = width * height;//计算长方形面积
printf ("面积是%d\n",area);//输出计算结果
return 0