摘要: #include #include using namespace std;int main(){ int a; cin >> a; assert(a>0); //assert,a>0时没问题,a<=0时 程序抛出异常 cout << a << endl; system("pause");} 阅读全文
posted @ 2013-07-10 23:55 Norcy 阅读(206) 评论(0) 推荐(0) 编辑
摘要: #include1、sscanf和scanf的不同是输入来源,前者是一个字符串,后者则是标准输入设备2、sscanf的使用,以解析时间字符串为例,将字符串“2009-01-02_11:12:13”解析为整型年月日时分秒//定义char cc;tm tm_temp={0};string stime("2009-01-02_11:12:13");//(1) 必须严格按照分隔符形式匹配填写,若遇到不匹配项则终止解析sscanf(stime.c_str(), "%4d-%2d-%2d_%2d:%2d:%2d",&tm_temp.tm_year, & 阅读全文
posted @ 2013-07-10 23:52 Norcy 阅读(719) 评论(0) 推荐(0) 编辑