您的位置:首页 > 编程语言 > C语言/C++

c++ 在console界面 简单实现进度条 正走,然后倒走 很好玩,嘎嘎

2010-02-20 16:34 801 查看
2010-02-21   16:02:15

 

c++ 在console界面 简单实现进度条 正走,

然后倒走 很好玩,嘎嘎  如题。感谢大家测试。

 

#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
system("color 2f");
int a=2,m=21,d=1;
int p=3;
SetConsoleTitle("vc++简单实现倒着走的进度条"); //设置标题

for(int  i=0;i<22;i++)
{
Sleep(30);
system("cls");

SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),4|BACKGROUND_BLUE); //加了些颜色
cout<<"╔═════════════════════╗"<<endl;
cout<<"║";

for(int x=20;x>i;x--)
{

if(x==0)
cout<<"█║";
else
cout<<"█";
}

if(m==0)
{
for(int r=0;r<22;r++)
{
Sleep(120);
system("cls");
cout<<"╔═════════════════════╗"<<endl;
cout<<"║";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),3); //加了些颜色
for(int j=0;j<r;j++)
{
if(j==20)
cout<<"█║";
else
cout<<"█";
}
cout<<endl;
cout<<"╚═════════════════════╝"<<endl;
d=0;
}

}

if(d)
{
cout<<endl;
cout<<"╚═════════════════════╝"<<endl;
m--;
}

}

return 0;
}


 

参考明次的 百度空间 ,点击这里访问。感谢之。 (vc++简单实现进度条效果)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息