您的位置:首页 > 其它

string对象代替char数组实现字符串的组合存储并显示

2016-10-14 09:23 399 查看
// practice4-4.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <string>

int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
string firstName;
string lastName;
string fullName;
cout<<"Enter your first name:";
cin>>firstName;
cout<<"Enter your last name:";
cin>>lastName;
fullName=lastName+',';
fullName=fullName+firstName;
cout<<"Here's the information in a single string:"<<fullName<<endl;
system("pause");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐