Chinaunix首页 | 论坛 | 博客
  • 博客访问: 522378
  • 博文数量: 252
  • 博客积分: 6057
  • 博客等级: 准将
  • 技术积分: 1635
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-21 10:17
文章分类

全部博文(252)

文章存档

2013年(1)

2012年(1)

2011年(32)

2010年(212)

2009年(6)

分类: C/C++

2010-08-07 22:54:10

//上次也写了个进度条程序,不过是需要清屏的,运行起来不是很美观吧!现在换种版本^_^

【进度条代码】:

#include 
#include
#include
using namespace std;

int main()
{
SetConsoleTitle("这是一个进度条程序"); //标题
COORD pos; //定义一个位置变量
pos.X=2; //注意X要大写
pos.Y=1; //同上Y要大写
cout<<"╔═════════════════════╗"<<endl;
cout<<"║ ║"<<endl;
cout<<"╚═════════════════════╝"<<endl;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos); //设置光标在(2,1)位置
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12|1);
for(int i=0;i<21;i++)
{
Sleep(150);
cout<<"█";
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7); //字体色为白
cout<<endl;
cout<<endl;
return 0;
}

【运行结果】:


嘿嘿,这个进度条可爱吧,粉色滴!






阅读(2345) | 评论(3) | 转发(0) |
给主人留下些什么吧!~~

chulia200020012010-08-07 23:00:23

c++ 控制台模式下实现的简单进度条 http://blog.csdn.net/zxcv8356631/archive/2009/06/17/4277114.aspx c++写的进度条 其实和c语言没什么大区别 只是用了c++的cin,cout //IDE:dev-c++ #include using namespace std; void cf_ProgressBar( int n ) { char c = (char)22; if( n!=1 ) { if( n%2 == 0 ) { cout << "\b\b\b\b\b"; cout << c << " "; if( n < 10 ) cout << " " << n << "%"; else cout << n << "%";

chulia200020012010-08-07 22:59:48

用C实现进度条效果 http://www.c-home.cn/View.aspx?id=91 用C语言编程实现进度条效果,如下图所示。 [flash=400,30]swf/56.swf[/flash] 示例1: /*调试环境:TC 2.0 英文版*/ #include void process() { unsigned long d; printf("\t"); d=0; for (;d<=65000000;d++) { if (d%1000000==0) printf("%c%c%d%%\b\b\b\b",219,219,d/650000); } putchar('\n'); printf("\n\tLOADING ACCOMPLISHED ! ANY KEY TO LOGIN !"); getch(); } main() { process(); } 示例2:

chulia200020012010-08-07 22:57:27

c++ 在console界面 简单实现进度条 正走,然后倒走 很好玩,嘎嘎 http://blog.csdn.net/lixiaodaoaaa/archive/2010/02/20/5313081.aspx c++ 在console界面 简单实现进度条 正走, 然后倒走 很好玩,嘎嘎 如题。感谢大家测试。 c++ 在console界面 简单实现进度条 正走, #include #include 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