/*Thisprogramwritestwomessagestothescreen,sayanythingatall.Butmakethemessagesontwoseparatelines.*///Thisisacomment.//ThisisaC++program.#includeiostream.hvoidmain(){doublex,y;cout″Entertwofloatnumbers:″;cinxy;doublez=x+y;cout″x+y=″zendl;}#includeiostream.hvoidmain(){inta,b;a=5;b=7;cout″a*b=″a*bendl;}#includeiostream.hvoidmain(){inta,b;a=5;b=7;cout″a*b=″a*bendl;}a*b=35File→New→File→C++SourceFile#includeiostream.hintadd(int,int);voidmain(){inta,b;a=5;b=7;intc=add(a,b);cout″a+b=″cendl;}intadd(intx,inty){returnx+y;}xx.obj—0error(s),0Warning(s)××.exe—0error(s),0warning(s)a+b=12Pressanykeytocontinue#includeiostream.hintadd(int,int);voidmain(){inta,b;a=5;b=7;intc=add(a,b);cout″a+b=″cendl;}intadd(intx,inty){returnx+y;}a+b=12#includeiostream.hvoidmain(){cout″BeiJing″″″;cout″ShangHai″″\n″;cout″TianJing″endl;}#includeiostream.hvoidmain(){inta,b;cout″Inputa,b:″;cinab;cout″a=″a″,″″b=″bendl;cout″a-b=″a-b″\n″;}#includeiostream.hvoidmain(){charc=′m′;intd=5;cout″d=″d″;″;cout″c=″c″\n″;}main(){cout″Thisisastring!″}#includeiostream.hvoidmain(){cinx;intp=x*x;cout″p=p\n″;}#includeiostream.hvoidmain(){inti,j;i=5;intk=i+j;cout″i+j=″k″\n″;}\ddd\xhh\101或\x41″Thisisastring.″″abcdef\n″″\tabc\txyz!\mnp\tefg!″′m′-′p′+1″m″+″p″+1constintsize=80;charc;c=′a′;doubleprice=15.5;intsize=100;inta[3];charb[3][5];floatc[3][5][7];constintsize=80;intm[size];232数组的赋值inta[5];intb[2][4];intc[2][3][4];inta[5]={1,2,3,4,5};inta[4]={5,4};intb[2][3]={{1,2,3},{4,5,6}};intb[2][3]={1,2,3,4,5,6};intb[2][3]={{1,2},{3}};intc[2][3][2]={{{1,2},{3,4},{5,6}},{{7,8},{9,10},{11,12}}};intc[2][3][2]={1,2,3,4,5,6,7,8,9,10,11,12};intc[2][3][2]={{{5,4},{3}},{{2},{1,0}}};intm[3];m[0]=5;m[1]=3;m[2]=1;inta[10];for(inti=0;i10;i++)a[i]=i*2+1;chars1[4]={′a′,′b′,′c′,′d′};chars2[5]={′a′,′b′,′c′,′d′,′\0′};chars2[5]=″abcd″;chars3[5]=″abcde″;chars3[]=″abcde″;charss[3][4]={{′a′,′b′,′c′,′\0′},{′m′,′n′,′p′,′\0′},{′x′,′y′,′z′,′\0′}};charss[3][4]={″abc″,″mnp″,″xyz″};charss[][4]={″abc″,″mnp″,″xyz″};charsss[][3][5]={″wang″,″hang″,″lang″,″tang″,″fang″,″kang″};enum枚举名{枚举表};enumday{Sum,Mon,Tue,Wed,Thu,Fri,Sat};enumday{Sum=7,Mon=1,Tue,Wed,Thu,Fri,Sat};enum枚举名枚举变量名表;enumdayd1,d2,d3;enumday{Sum,Mon,Tue,Wed,Thu,Fri,Sat}d1,d2,d3;enumcolor{RED,BLUE,YELLOW,BLACK,WHITE};enumcolorc1,c2,c3;d1=Sum;d2=Sat;c1=RED;c2=BLUE;d3=YELLOW;c3=3;c3=(enumcolor)3;c3=enumcolor(3);c3=BLACK;inta(5);int*p=&a;类型*指针名,*指针名,…;int*pi;//pi是一个指向int型变量的指针float*pl;//pl是一个指向float型变量的指针char*pc;//pc是一个指向char型变量的指针char(*pa)[3];//pa是一个指向一维数组的指针int(*pf)();//pf是一个指向函数的指针,该函数的返回值为int型数值int**pp;//pp是一个指向指针的指针,即二级指针inta,b[10];inta[10],*p=a;intb[2][3],(*p)[3];p=b;doublesin(doublex);double(*pf)();pf=sin;inta,*p=&a,*q;q=p;inta[5];a[i]其中,i=0,1,2,3,4。*(a+i)inta[10],*p;p=a;intb[2][5];b[i][j]其中,i=0,1;j=0,1,2,3,4。*(*(b+i)+j)其中,i=0,1;j=0,1,2,3,4。*(*(b+i)+j)*(b[i]+j)(*(b+i))[j]*(&b[0][0]+5*i+j)#includeiostream.hvoidmain(){staticinta[5]={5,4,3,2,1};inti,j;i=a[0]+a[4];j=*(a+2)+*(a+4);coutiendlj;}#includeiostream.hvoidmain(){staticchars1[]=″abcde″,s2[5]={′m′,′n′,′p′,′q′,′\0′};char*ps=s1;couts1″or″s2;cout′\n′;couts2[1]s2[2]s1[3]s1[4]endl;cout*ps*(ps+2)*(ps+4)*ps+2;}abcdeormnpqnpdeace99#includeiostream.hvoidmain(){staticintb[][3]={{1,2,3},{4},{5,6}};b[0][2]=7;b[1][2]=8;cout**b″\t″**(b+1)″\t″*(*(b+1)+2)″\n″;coutb[0][2]+b[1][2]+b[2][2];}14815#includeiostream.hvoidmain(){staticchart[][3][5]={″abcd″,″efgh″,″ijkl″,″mnop″,″qrst″,″uvwx″};coutt[1][2][3]*(t[1][2]+3)*(*(*(t+1)+2)+3)*(*(t[1]+2)+3)endl;cout**t″\t″*(*(t+1)+1)″\t″t[0][2]″\t″**t+1endl;}xxxxabcdqrstijklbcd类型&引用名(变量名);类型&引用名=变量名;inta=3;int&m=a;m=m+5;intn=m;int*p=&m;int&d=120;intt=120;int&d=t;floatf=5.6int&e=f;inttemp=int(f);int&e=temp;#includeiostream.hvoidmain(){intval(5);int&refv=val;refv=refv+5;coutvalendl;int*p=&refv,val1(refv);cout*p″\t″val1endl;}inta[10];sizeof(int);sizeofa;sizeof(a)/sizeof(int);inta;doubleb=3.8921;a=int(b)+(int)b;inta,*pa;pa=&a;inta,*pa=&a;*pa=5;inta(3)b(5);a+]++b#includeiostream.hvoidmain(){inta;a=7*2+-3%5-4/3;floatb;b=510+3.2e3-5.6/0.03;couta″\t″bendl;intm(3),n(4);a=m++---n;couta″\t″m″\t″nendl;}103523.33043#includeiostream.hvoidmain(){unsigneda(0xab),b(20);a&=b;a^=a;couta″\t″bendl;intx(-3),y(5);xy;x=y;x|[]|=y^~y;y&=~x+1;coutx″\t″yendl;}#includeiostream.hvoidmain(){charx(′m′),y(′n′);intn;n=xy;coutnendl;n=x==y-1;coutnendl;n=(′y′!=′Y′)+(53)+(y-x==1);coutnendl;}113inta(3),b(0);!a&&a+b&&a++;#includeiostream.hvoidmain(){intx,y,z;x=y=z=1;--x&&++y&&++z;coutx′\t′y′\t′z′\n′;++x&&++y&&++z;coutx′\t′y′\t′z′\n′;++x&&y--||++z;coutx′\t′y′\t′z′\n′;}#includeiostream.hvoidmain(){inta(3),b(4),c;c=ab?++a:++b;couta″,″b″,″cendl;c=a-b?a+b:a-3?b:a;couta″,″b″,″cendl;}inta,b,c,d;a=b=c=d=3;inta(3),b(4);a*=b+1;#includeiostream.hvoidmain(){intx(1),y(