现在的位置: 首页 > 综合 > 正文

C++ 在尾部添加字符串(两种方法) |C++ 连接字符串

2018年02月12日 ⁄ 综合 ⁄ 共 421字 ⁄ 字号 评论关闭

#include "stdafx.h"
#include "iostream"

#include <string>
using namespace std;

#include <ctype.h>


int _tmain(int argc, _TCHAR* argv[])
{
	//std::cout<<"come here"<<std::endl;

	//char s1[30] = "I love";
	//char *s2 = "C++";
	//stringcat(s1,s2);
	//std::cout<<s1<<std::endl;


	string a = "www.";
	a.append("baidu");

	cout<<a<<endl;

	string b = ".";
	b += "com";

	cout<<b<<endl;

	cout<<a.append(b)<<endl;

	system("pause");
	return 0;
}

//char *stringcat(char *source,const char *dest)
//{
//
//}

抱歉!评论已关闭.