C++第二章简单程序设计2.1.4-2.2.5

2.1.4字符集

用C++编写程序时,除了字符型数据外,其他所有成分都只能由字符集中的字符构成
**英文字母:A~Z,a ~z
**数字字符:0~9
**特殊字符:!# % ^ & * - + = - ~ < > / \ , " ; . ? ( ) [ ] { }

2.1.5词法记号

1.关键字
asm do if return typedef auto double inline short typeid bool dynamic_cast int signed typename break else long sizeof union case enum mutable static unsigned catch explicit namespace static_cast using char export new struct virtual class extern operator switch void const false private template volatile const_cast float protected this char continue for public throw while default friend register true delete goto reinterpret_cast try
2.标识符
标识符是程序员定义的单词,它命名程序正文中的一些实体,如函数名,变量名,类名,对象名。
*以大写、小写、或下划线开始
*以大写,小写,下划线,数字组成
*大写字母和小写字母代表不同的标识符
*不能是C++关键字
3.字符常量
字符常量是单引号括起来的一个字符,如‘a’;
4.字符串常量
字符串常量简称字符串,是用一对双引号括起来的字符序列,如“abcd”;

2.2.4符号常量

为常量命名称为符号常量,符号常量在使用之前要先声明。
声明语句形式为:
const 类型说明符 常量名 = 常量值

2.2.5运算符与表达式

运算符:+ - * /
表达式:由运算符,运算量和括号组成
例:a+b=10;

发布了5 篇原创文章 · 获赞 0 · 访问量 52

猜你喜欢

转载自blog.csdn.net/zyggangguigui/article/details/104252556