std::string

作者:追风剑情 发布于:2019-6-18 22:05 分类:C++

示例1:to_string()

#include <iostream>
#include <string>
using namespace std;

int main()
{
	const int SIZE = 4;
	string arr[SIZE];
	int i;
	for (i = 0; i < SIZE; i++)
	{
		arr[i] = "s" + to_string(i);
	}

	for (i = 0; i < SIZE; i++)
	{
		cout << (arr[i]) << " ";
	}

	cout << "\nPress any key to continue...";
	char pl[20];
	cin.getline(pl, 20);
	return 0;
}

运行测试

111.png

标签: C++

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号