摘要: Linux环境下:/**struct timeval { time_t tv_sec; // 秒 suseconds_t tv_usec; // 微妙 (10的负六次方)}; typedef struct timespec{time_t tv_sec;//秒long tv_nsex;//纳秒}timespec_t;**/#include <algorithm>#include <vector>#include <stdio.h>#include <stdlib.h>#include <sys/time.h>double getTime 阅读全文
posted @ 2012-05-17 23:37 KingsLanding 阅读(299) 评论(0) 推荐(0)
摘要: 今天在QQ群中有人问起这两个问题,我只是在oneNote中做过笔记,也不是很熟,只不过oneNote的搜索功能太难用了。觉得这些基本功问题还是要熟悉才好。首先是格式转换,什么浮点数转换为字符串,字符串转换为浮点数,建议使用C++ 的字符处理类,stringstream,在exceptional C++中好像说过sprintf什么的不是很安全。下面来看例子:#include <sstream>#include <iostream>using namespace std;int main() stringstream ss; double a = 3.141592; dou 阅读全文
posted @ 2012-05-17 23:32 KingsLanding 阅读(270) 评论(0) 推荐(0)