龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC++6.0写的等待提示

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
屏幕显示: Running ... [ 1 ] 位置 [ 1 ] 会有 " " " - " " / " " | " 循环交替出现,就像是一根木棒在旋转 以下是源代码: #include iostream #include fstream #include string using namespace std; //显示等待条 clas

屏幕显示:
Running ... [ 1 ]

位置 [ 1 ]  会有 "   "  "  -  "  "  /  "   "  |  "  循环交替出现,就像是一根木棒在旋转

以下是源代码:

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

//显示等待条

class Progress

{

public:

     //iv是等待的速度

     Progress(int iv=1)

     {

         intv=iv;

         cur=1;

         itmp=0;

     }

     //运行等待条

     void Do()

     {

         if (itmp==intv+1)

         {

              itmp=0;

              if (cur==4) cur=0;

              cur++;

         }

         itmp++;

     }

     //显示

     void Show()

     {

         switch(cur)

         {

         case 1:  cout << '-';   break;

         case 2:  cout << '';  break;

         case 3:  cout << '|';   break;

         case 4:  cout << '/';   break;

         }

         cout << '';

     }

private:

     int cur;

     int intv;

     int itmp;

};

int main() 

     //定义等待条的速度

     Progress prg(20);

     //显示等待

     while(1)

     {

         prg.Do();

         prg.Show();

     }

     return 0;

}

收藏文章
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
评论内容为空!
还没有评论,快来抢沙发吧!
按钮 内容不能为空!
立刻说两句吧! 查看0条评论
精彩图集

赞助商链接