Boost学习笔记(五) progress_display

progress_display可以在控制台显示程序的执行进度,如果程序执行很耗费时间,那么它能够提供一个友好的用户界面

#include <boost	imer.hpp>
#include  <boostprogress.hpp>
#include <boostprogress.hpp>
#include <vector>
#include <fstream>
#include <booststatic_assert.hpp>
#include <iostream>
using namespace boost;
using namespace std;

int main()
{
    vector<string> v(10000);  //一个字符串向量
    for(int i=0;i<10000;i++)  //初始化字符串向量
        v[i]="a";

    ofstream fs("c:\test.txt"); //文件输出 流
    progress_display pd(v.size());  //声明一个progress_display对象,基数是v的大小

    vector<string>::iterator pos;  //迭代器
    //开始写入文件
    for(pos=v.begin();pos!=v.end();++pos)
    {
        fs<<*pos<<endl;
        ++pd;
    }
}
原文地址:https://www.cnblogs.com/zzu-liulei/p/6081701.html