Posts

Showing posts from February, 2021

Loading Bar In C++

CONSOLE BASE LOADING BAR: CODE: // C++ program to create loading bar  #include <iostream>  #include <windows.h>  using namespace std;  // Function to creating loading bar  void loadingBar()  {  // 0 - black background,  // A - Green Foreground  system("color 0A");  // Initialize char for printing  // loading bar  char a = 177, b = 219;  printf("\n\n\n\n");  printf("\n\n\n\n\t\t\t\t\t" + "Loading...\n\n");  printf("\t\t\t\t\t");  // Print initial loading bar  for (int i = 0; i < 26; i++)  printf("%c", a);  // Set the cursor again starting  // point of loading bar  printf("\r");  printf("\t\t\t\t\t");  // Print loading bar progress  for (int i = 0; i < 26; i++) {  printf("%c", b);  // Sleep for 1 second  Sleep(1000);  }  }  // Driver Code  int main()  {  //...

How to add Timer in Your C++ Program:

 Use this code to add Timer in your code for Linus use clear instead of cls: #include <iomanip>  #include <iostream>  #include <stdlib.h>  #include <unistd.h>  using namespace std;     // hours, minutes, seconds of timer  int hours = 0;  int minutes = 0;  int seconds = 0;     // function to display the timer  void displayClock()  {      // system call to clear the screen      system("cls");         cout << setfill(' ') << setw(55) << "         TIMER         \n";      cout << setfill(' ') << setw(55) << " --------------------------\n";      cout << setfill(' ') << setw(29);      cout << "| " << setfill('0') << setw(2) << hours << " hrs | ";      c...

How to Change your (dev/visual) console color

     Here I'm Sharing how can you change your console color Also  How to print Colored text in C++ As you know, In C++ Programming the output screen color is black and the text is in white color but we can change it using these steps: Step 1: Add these Header Files #include <windows.h> or #include <stdlib.h> Step 2: Use this syntax  system("Color XY") Here the value X is use to change Background color and and the value Y is used to change the text color. Use these color id's in XY value: