2.1.4 字符集
字符集是构成C++语言的基本元素。用C++语言编写程序时,除字符型数据类型外,其他所有成分都只能由字符集中的字符构成。C++语言的字符集由下述字符集构成。
英文字符:A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
数字字符:0,1,2,3,4,5,6,7,8,9
特殊字符:
! # % ^ & * _ +
= - ~ < > / \ '
" ; . , : ? ( )
[ ] { }
2.1.5词法记号
1.关键字
//C++中的所有关键字
asm auto bool break case catch char
class const const_char continue default delete do
double dynamic_cast else enum explicit export extern
false float for friend goto if inlinie
int long mutable namespace new operator private
protected public register reinterpreter_cast return short signed
sizeof static static_cast struct switch template this
throw true try typedef typeid typename union
unsigned using virtual void volatile wchar_t while
我认为常用的
//我认为常用的
bool break case catch char class const
const_cast delete do double else enum
false float for friend goto if int
long namespace new private protected public
return short signed sizeof static struct
switch template this throw true try
typedef typename unsigned using virtual
void while
2.标识符
i.可以由大写、小写、下划线、数字组成,但不能由数字开头。
ii.大小写敏感
iii.不能是C++关键字
3.文字
文字是在符号中直接用符号表示的数据,包括数字、字符、字符串和布尔文字
4.操作符(运算符)
+,-,*,/,...
5.分隔符
() {} , : ;
6.空白
空格、制表符、垂直制表符、换行符、回车符和注释的总称
空白符用于指示词法记号的开始和结束的位置,但除此以外,其他的空白都将被忽略。因此,C++程序可以不必严格地按行书写,凡是可以出现空格地地方,都可以出现换行。