カウンタは使用せず、イテレータを使っているので、現在の処理がどのくらいまで
進んだかを知る方法が思いつかないのですが、どういった方法があるでしょうか?
#include <windows.h>
#include <stdio.h>
#pragma warning ( disable: 4786 )
#include <string>
#include <vector>
using namespace std;
void Print( vector<string> *v )
{
vector<string>::iterator p = v->begin();
while( p != v->end() )
{
// ここに全体の処理の進み具合を表示したい
printf( p->c_str() );
Sleep( 5000 );
p++;
}
}
void Init( vector<string> *v )
{
char mes[80] = "ヤンマーニ\n";
int i;
for( i=0; i<10; i++ )
{
v->push_back( mes );
}
}
int main()
{
vector<string> v;
Init( &v );
Print( &v );
return 0;
}
[pre]