码迷,mamicode.com
首页 > 其他好文 > 详细

std::cin

时间:2014-08-09 13:18:47      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   strong   for   2014   

Input: Executing std::cin >> v discards any whitespace characters in the standard input stream, then reads from the standard input into variable v. It returns std::cin, which has type istream, in order to allow chained input operations.

int _tmain(int argc, _TCHAR* argv[])
{
        // ask for the person‘s name
        std::cout << "Please enter your first name: ";

        // read the name
        std::string name;         // define name
        std::cin >> name;         // read into

        // write a greeting
        std::cout << "Hello, " << name << "!" << std::endl;

    std::string stars(100, *);      // construct the variable
    std::cout << stars;
    return 0;

}

 

Output:

bubuko.com,布布扣

 

std::cin,布布扣,bubuko.com

std::cin

标签:style   blog   http   color   io   strong   for   2014   

原文地址:http://www.cnblogs.com/anit/p/3900725.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!