每天敲代码2020908 30行

#include
#include
using namespace std;

int main()
{
using namespace std;
string one(“Lottery Winner”);//赋值给one
cout << one << endl; //输出:Lottery Winner
string two(20, ' ) ; / / : '); //输出: $$$$$$$$$$$$$$$$$$$ (20, ' ) 20 ')输出20个 的意思
cout << two << endl;
string three(one); //输出:Lottery Winner 把one的值通过函数赋值给three
cout << three << endl;
one += “Oops”;// one=one+Oops;
cout << one << endl; //输出:Lottery WinnerOops
two = “Sorry! That was”; //Sorry! That was赋值给two
three[0] = ‘p’; //变量three数组偏移量0是字符串 p
string four;//声明 string类型的four
four = two + three;
char alls[] = “All’s well that ends well”;
string five(alls,20); //输出:All’s well that ends! 声明这个语句alls有20个偏移量
cout << five << “!\n”;
string six(alls + 6, alls + 10); //输出:well 是取了6-10字母的意思把
cout << six << " ";
string seven(&five[6], &five[10]); //输出了well… 取了five偏移6 -five偏移10
cout << seven << “…\n;”;
string eight(four, 7, 16);//Sorry! That wasLottery Winner //取了four中的7-16字符
cout << eight << “in motion” << endl;//输出:That waspottery in motion
return 0;
}

猜你喜欢

转载自blog.csdn.net/ADADQDQQ/article/details/108461031
今日推荐