C++ Wizarding World
-
#include <iostream>
using namespace std;
cout<< “Welcome to c++ wizarding world… Here is all about c++ questions, answers and many things to learn and improve….
#include <iostream> #include <chrono> #include <thread> #include <iomanip> using namespace std; using namespace chrono; void drawProgressBar(double progress) { int barWidth = 50; cout << "["; int pos = barWidth * progress; for (int i = 0; i < barWidth; ++i) { if (i < pos) cout << "="; else if (i == pos) cout << ">"; else cout << " "; } cout << "] " << int(progress * 100.0) << " %\r"; cout.flush(); } int main() { const int total = 10000000; auto start = high_resolution_clock::now(); for (int i = 0; i < total; ++i) { if (i % 100000 == 0) drawProgressBar((double)i / total); } drawProgressBar(1.0); auto end = high_resolution_clock::now(); duration<double> elapsed = end - start; cout << "\n C++ finished in " << fixed << setprecision(6) << elapsed.count() << " seconds!" << endl; return 0; }