C++博客 :: 首页 :: 新随笔 ::  ::  :: 管理

getline() 函数

Posted on 2011-05-27 23:50 Kevin_Zhang 阅读(283) 评论(0)  编辑 收藏 引用 所属分类: C/C++
// test3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include 
"iostream"
#include 
"string"
#include 
"stdio.h"


using namespace std;


int main(int argc, char* argv[])
{   
    
    
string str1,str2,str3;
    getline(cin,str1);
    getline(cin,str2);
    str3
=str1+str2;
    cout
<<str1<<endl<<str2<<endl<<str3<<endl;
    cout
<<str1[0]<<endl<<str2[0]<<endl;
    
return 0;
}


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理