Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2508541
  • 博文数量: 308
  • 博客积分: 5547
  • 博客等级: 大校
  • 技术积分: 3782
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-24 09:47
个人简介

hello world.

文章分类

全部博文(308)

分类: C/C++

2010-11-09 16:24:54

    编写一程序,将两个字符串连接起来,结果取代第一个字符串。要求用string方法。

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

int main()
{
    string str1,str2;
    cin >> str1;
    cin >> str2;
    
    cout << "str1:" << str1 << endl;
    cout << "str2:" << str2 << endl;
    str1 = str1 + str2;
    cout << "contact result :" << str1 << endl;
    system("pause");
    return 0;
}


阅读(1645) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~