C++ primer plus(第六版)编程练习答案 第16章 string类和标准模板库

一、程序清单

str1.cpp 

// str1.cpp -- introducing the string class
#include 
#include 
// using string constructors

int main()
{
	using namespace std;
	string one("Lottery Winner!");     // ctor #1
	cout << one << endl;               // overloaded <<
	string two(20, '$');               // ctor #2
	cout << two << endl;
	string three(one);                 // ctor #3
	cout << three << endl;
	one += " Oops!";                   // overloaded +=
	cout << one << endl;
	two = "Sorry! That was ";
	three[0] = 'P';
	string four;                       // ctor #4
	four = two + three;                // overloaded +, =
	cout << four << endl;
	char alls[] = "All's well that ends well";
	string five(alls, 20);              // ctor #5
	cout << five << "!\n";
	string six

你可能感兴趣的:(C++,primer,plus(第六版)编程练习答案,c++,开发语言,算法)