c++ boost--------------boost::progress_timer小试。
2013-09-25 00:21
381 查看
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit4.h" #include <boost/progress.hpp> #include <sstream> using namespace std; //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm4 *Form4; //--------------------------------------------------------------------------- __fastcall TForm4::TForm4(TComponent* Owner) : TForm(Owner) { } void test_timer(std::stringstream& ss) { ss.clear(); boost::progress_timer t(ss); { //boost::progress_timer t1(ss); Sleep(1000); //Form4->Memo1->Lines->Add((AnsiString)"1--"+ss.str().c_str()); } { //boost::progress_timer t2(ss); //boost::progress_timer t(ss); Sleep(2001); //Form4->Memo1->Lines->Add((AnsiString)"2--"+ss.str().c_str()); } { //boost::progress_timer t3(ss); //boost::progress_timer t(ss); Sleep(3002); //Form4->Memo1->Lines->Add((AnsiString)"3--"+ss.str().c_str()); } } //--------------------------------------------------------------------------- void __fastcall TForm4::Button1Click(TObject *Sender) { std::stringstream ss; test_timer(ss); this->Memo1->Lines->Add(ss.str().c_str()); } //---------------------------------------------------------------------------
相关文章推荐
- C++中如何建立一个顺序表
- C++中如何建立一个顺序表
- C++临时对象
- Barcode Xpress如何在Visual C++中作为COM对象使用(2)
- C语言打印圣诞树
- 编程基础------C和C++函数的相互引用----C++中extern “C”含义
- LIB和DLL的区别与使用
- VC++ win32 多线程 一边画圆一边画矩形
- 走进C++程序世界------继承和派生
- C++ 函数指针
- A fast lock-free queue for C++
- C++ 中通过GetAdaptersInfo获取网卡配置和Ip地址信息
- C语言中的while循环和for循环
- C语言左移右移
- C++的单例模式
- 一个c++程序员的读书笔记(一)
- 关于c++的内联函数
- 【一天一篇CPP】对象与指针与数组 对象和const和指针和引用
- 【C++第三课】---新的关键字
- 九度OnlineJudge之1032:ZOJ