C语言控制台窗口制作进度条代码

C语言控制台窗口制作进度条代码

C语言实例qingyu2022-02-21 22:57:58818A+A-

欢迎界面.gif

#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
//UI
void cls();
void loadingbar();
void ccolor(int clr);
void cls() {
  system("cls");
}
void ccolor(int clr){

  HANDLE  hConsole;
  hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  SetConsoleTextAttribute(hConsole, clr);

}

void loadingbar(void) {

  for (int i = 15; i <= 100; i += 5) {

    cls();
    ccolor(26);
    printf("\n\n\n\n\n\n\n\t\t\t\t");
    printf("%d %% Loading...\n\n\t\t", i);
    printf("");
    for (int j = 0; j < i; j += 2) {
      ccolor(160 + j);
      printf(" ");
      ccolor(26);
    }
    Sleep(100);
    if (i == 90 || i == 50 || i == 96 || i == 83) {
      Sleep(100);
    }
  }
}

//
int main() {
  system("mode con: cols=80 lines=30");
  loadingbar();
  cls();
  return 0;
}


点击这里复制本文地址 欢迎来到大黄鸡源码分享网
qrcode

大黄鸡源码编程网 © All Rights Reserved.  
网站备案号:闽ICP备18012015号-4
Powered by Z-BlogPHP
联系我们| 关于我们| 广告联系| 网站管理