标题:计时小程序遇到问题,请教!!!!谢谢
只看楼主
haovv
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2008-9-19
结帖率:100%
 问题点数:0 回复次数:2 
计时小程序遇到问题,请教!!!!谢谢
#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 编辑 ]
搜索更多相关主题的帖子: 计时 
2010-02-03 22:12
ly861014
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:66
专家分:177
注 册:2008-10-28
得分:0 
回复 楼主 haovv
我个人觉得是这样的,我拿VC6.0 编译器来解释一下
其实输出的次数是一样的,只不过那个黑屏上没显示全,因为第二次要显示的内容太多,他只能显示最后能显示的部分,之前的我们看不到了
2010-02-03 22:40
haovv
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2008-9-19
得分:0 
屏幕上下拖拖还可以看到啊,且你输入较小的数如2 ,结果也不另人满意
2010-02-03 22:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-297194-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019632 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved