独木
fox000002
全部博文(12)
2009年(1)
2008年(11)
叹季升物
czmczm3
战神_巫
分类: C/C++
2008-08-21 20:55:48
#include <iostream> #include <iomanip> #include <string> #include <boost/version.hpp> #include <boost/lexical_cast.hpp> #include <boost/format.hpp> using boost::format; using boost::io::group; int main(int argc, char * argv[]) { // Boost Version Check std::cout << "-------------------------------------------------" << '\n'; std::cout << "\t" << "Checking Boost's Version... \n"; std::cout << "\t" << "Version: " << BOOST_VERSION << '\n'; std::cout << "-------------------------------------------------" << '\n'; // data type convertion using boost::lexical_cast; std::string str = "123"; int a = lexical_cast<int>(str); double b = lexical_cast<double>(str); std::setprecision(10); std::setfill('*'); std::cout << "\t" << "string: " << "\t" << str << '\n'; std::cout << "\t" << "int: " << "\t\t" << a + 1 << '\n'; std::cout << "\t" << "double: " << "\t" << b + 1.1 << '\n'; std::cout << format("%1% %2% %3% %2% %1% \n") % "11" % "22" % "333"; // 'simple' style. system("sleep 2"); return 0; }
上一篇:程序备份脚本
下一篇:Hello From Ada
登录 注册