- 184 名前:デフォルトの名無しさん mailto:sage [2008/02/11(月) 19:38:23 ]
- >>180
#include <iostream> #include <string> #include <boost/regex.hpp> int main() { while (true) { std::cout << "入力: "; std::string line; if (!std::getline(std::cin, line)) break; boost::regex re_num("\\d+"); if (boost::regex_search(line, re_num)) { std::cout << "※エラー※数値が入力されました" << std::endl; std::cout << "もう一度入力してください" << std::endl; continue; } boost::regex re_str("^a+"); std::cout << "出力: " << boost::regex_replace(line, re_str, "") << std::endl; break; } }
|

|