首页 > 其他 > 详细

std::cin

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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!