首页 > 编程语言 > 详细

C++ Primer第四版习题--3.10

时间:2015-05-06 10:59:13      阅读:90      评论:0      收藏:0      [点我收藏+]
#include <iostream>
#include <string>
#include <cctype>

int main()
{
    std::string str, result_str;
    bool flag=false;
    while(getline(std::cin, str))
    {
        for(unsigned index=0; index<str.size(); ++index)
        {
            char ch;
            ch = str[index];
            if(ispunct(ch))
                flag = true;
            else
                result_str += ch;
        }
        if(flag)
            std::cout << result_str << std::endl;
        else
            std::cout << "no flag" << std::endl;
    }
    return 0;
}

C++ Primer第四版习题--3.10

原文:http://blog.csdn.net/xumesang/article/details/45532383

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