Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ progress bar

float progress = 0.0;
while (progress < 1.0) {
    int barWidth = 70;

    std::cout << "[";
    int pos = barWidth * progress;
    for (int i = 0; i < barWidth; ++i) {
        if (i < pos) std::cout << "=";
        else if (i == pos) std::cout << ">";
        else std::cout << " ";
    }
    std::cout << "] " << int(progress * 100.0) << " %
";
    std::cout.flush();

    progress += 0.16; // for demonstration only
}
std::cout << std::endl;
Comment

cpp console progressbar

float progress = 0.0;
while (progress < 1.0) {
    int barWidth = 70;

    std::cout << "[";
    int pos = barWidth * progress;
    for (int i = 0; i < barWidth; ++i) {
        if (i < pos) std::cout << "=";
        else if (i == pos) std::cout << ">";
        else std::cout << " ";
    }
    std::cout << "] " << int(progress * 100.0) << " %
";
    std::cout.flush();

    progress += 0.16; // for demonstration only
}
std::cout << std::endl;
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ get line 
Cpp :: unique_ptr syntax 
Cpp :: function in struct c++ 
Cpp :: memory leak in cpp 
Cpp :: c++ struct 
Cpp :: What is the "--" operator in C/C++? 
Cpp :: sleep in c++ 
Cpp :: C++ fill string with random uppercase letters 
Cpp :: string length in c++ 
Cpp :: convert characters to lowercase c++ 
Cpp :: what is g++ and gcc 
Cpp :: Converting to string c++ 
Cpp :: how can we create 4 digit random number in c++ 
Cpp :: c++ vector remove all duplicate elements 
Cpp :: how to cout in c++ 
Cpp :: c++ header boilerplate 
Cpp :: cpp detect os 
Cpp :: c++ syntax 
Cpp :: c++ reverse part of vector 
Cpp :: how to make a square root function in c++ without stl 
Cpp :: is anagram c++ 
Cpp :: do while c++ 
Cpp :: linux c++ sigint handler 
Cpp :: set of vectors c++ 
Cpp :: loop execution descending order in c++ 
Cpp :: matrix c++ 
Cpp :: ue4 int to enum c++ 
Cpp :: arduino falling edge 
Cpp :: cyclically rotate an array by once 
Cpp :: loops in c and c ++ 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =