注册 登录
编程论坛 C++教室

计时小程序遇到问题,请教!!!!谢谢

haovv 发布于 2010-02-03 22:12, 548 次点击
#include <iostream.h>
#include<ctime>
enum Color{BLACK,WHITE,BLUE};
int main()
{
    long t1;
    int  set;
    cin>>set;
    for(int i=1;i<=set;i++)
    {
        t1=time(NULL);
        t1++;
        while(time(NULL)<t1);
        
        cout<<"**************************"<<endl;
            
        
    }
    cout<<"the time is comming!";
}//这个程序的本意
#include <iostream.h>
#include<ctime>
enum Color{BLACK,WHITE,BLUE};
int main()
{
    long t1;
    int  set;
    cin>>set;
    for(int i=1;i<=set;i++)
    {
        t1=time(NULL);
        t1++;
        while(time(NULL)<t1)
        {cout<<"-";}
        
        cout<<"**************************"<<endl;
            
        
    }
    cout<<"the time is comming!";
}//这个结果和上个结果********************的显示次数不同,为什么??

[ 本帖最后由 haovv 于 2010-2-3 23:19 编辑 ]
2 回复
#2
ly8610142010-02-03 22:40
回复 楼主 haovv
我个人觉得是这样的,我拿VC6.0 编译器来解释一下
其实输出的次数是一样的,只不过那个黑屏上没显示全,因为第二次要显示的内容太多,他只能显示最后能显示的部分,之前的我们看不到了
#3
haovv2010-02-03 22:45
屏幕上下拖拖还可以看到啊,且你输入较小的数如2 ,结果也不另人满意
1