The Easiest Way to Save and Share Code Snippets on the web

Cout override

cpp

posted: May, 2nd 2010 | jump to bottom

//============================================================================
// Name        : hello.cpp
// Author      : 
// Version     :
// Description : Hello World in C++, Ansi-style
//============================================================================
 
#include <iostream>
#include <cstdlib>
#include <string>
 
using namespace std;
 
int main() {
 
	string a = "|=";
	for (int i = 0; i < 100; i++) {
 
		cout << a << i << "%\r" << flush;
		system("sleep 0.1s");
		if((i % 5) == 0){
			a += "=";
		}
	}
	a += "| Done!";
	cout << a;
	cin.get();
	return 0;
}
24 views