Boapath

   :: 首页  :: 新随笔  ::  ::  :: 管理

 

返回控制台:

  linux: freopen("/dev/tty", "r", stdin);

  win: freopen("CON","r",stdin);

getline:

  getline(cin,para);

把string变成char* :

  const char *sname = cname.c_str();

stringstream的使用:

用于类型转换: http://www.cppblog.com/Sandywin/archive/2007/07/13/27984.html

注意:遇到空格会停止。

例: 

1     string s = "this is a test";
2     stringstream ss;
3     ss << s;
4     string st;
5     ss >> st; 
6     cout<<st<<endl;        

输出结果为:this

 

 

记录一下:

ans = (int)pow(10, 2 + fmod(K * log10(N), 1)); 取N^k高三位

posted on 2014-02-26 14:40  Boapath  阅读(247)  评论(0编辑  收藏  举报