???????C++?е??????????????????????
?????goldensun ???????[ 2016/12/27 10:52:46 ] ???????????? ?????
????C++???????
???????????????????????????????飬????????е??????????????????????????????????????????????????ù???C??C++?????????????????÷????????
????????????????????
????????????????????????????????????磺
????char c[10];
????c[0]=′I′;c[1]=′ ′;c[2]=′a′;c[3]=′m′;c[4]=′ ′;c[5]=′h′;c[6]=′a′;c[7]=′p′;c[8]=′p′;c[9]=′y′;
???????漲????c???????飬????10????????????????????????????
???????????????г?????????????????????????????????и???????
????char c[10]={'I'??' '??'a'??'m'??' '??'h'??'a'??'p'??'p'??'y'};
??????10??????????c[0]~c[9]??10??????
????????????????????????????????鳤????????????????????????С?????鳤??????????Щ??????????????????Щ????????????????????????????????????????????????鳤???????????????????????鳤??????????????????????????鳤????磺
????char c[]={'I'??' '??'a'??'m'??' '??'h'??'a'??'p'??'p'??'y'};
?????????????????????????????飬??
????????????:
????char diamond[5][5]={{' '??' '??'*'}??{' '?? '*'??' '??'*'}??{'*'??' '??' '??' '??'*'}??{' '??'*'??' '??'*'}??{' '??' '??'*'}};
????????????????????
????????????????????????????????????????????鴛????磺
????char c[5];
????c={'C'??'h'??'i'??'n'??'a'}; //???????????????????θ??
????c[0]='C'; c[1]='h';c[2]='i';c[3]='n';c[4]='a'; //????????????????
??????????????a??b????????????????????飬??b?????????????????????
????a=b; //????????????????????帳?
????a[0]=b[0]; //????????????????
?????????????????????????Ρ?
????#include <iostream>
????using namespace std;
????void main( )
????{
????char diamond[][5]={{' '??' '??'*'}??{' '??'*'??' '??'*'}??{'*'??' '??' '??' '??'*'}??{' '??'*'??' '??'*'}??{' '??' '??'*'}};
????int i??j;
????for (i=0;i<5;i++)
????{
????for (j=0;j<5;j++)
????cout<<diamond[i][j]; //???????????????????????????
????cout<<endl;
????}
????}
????C++??????????????—??????????????????
???????????????????????????????????????????
????C++????????μ?????????——?????????(string????)??????÷??????????char??int???????????????????????????????????????——?????????????????????С?
??????????string??????C++?????????е???????????????C++?????????????????????????????????????????????????????????string??????????
???????????????????????
????1) ?????????????
?????????????????????????????????????????????????????????????????string???磺
????string string1; //????string1??????????
????string string2=″China″; //????string2??????????
??????????????string?????????????????????????C++??????е?string?????????????????????
????#include <string> //?????????????string.h
????2) ???????????????
???????????????????????????????????????????????????????磺
????string1=″Canada″;
?????????????????????????????????????????????????????????????????????????????磺
????string2=string1; //????string2??string1?????????????????
?????????string2??string1?????????????string2?????″China″??string1?????″Canada″???????string2????″Canada″??????????????????????????????????????е??????????????
????????????????????????????в??????磺
????string word=″Then″; //???岢??????????????word
????word[2]=′a′; //???????2???????????word????″Than″
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11