queuetst.cpp

来自「hello everybody. good lucky to you」· C++ 代码 · 共 56 行

CPP
56
字号
#ifndef __LTIME_H
#include <LTime.h>
#endif	// __LTIME_H

#ifndef __QUEUE_H
#include <Queue.h>
#endif	// __QUEUE_H

#ifndef __IOSTREAM_H
#include <iostream.h>
#endif

#ifndef __DOS_H
#include <dos.h>
#endif

#ifndef __STDLIB_H
#include <stdlib.h>
#endif


int main()

{


    int k;
    Queue timeLine;
    cout << "\nSampling";
    for( int i = 0; i < 7; i++ )
	{
	struct time snapShot;
	gettime( &snapShot );
	Time sample( snapShot.ti_hour,
		     snapShot.ti_min,
		     snapShot.ti_sec,
		     snapShot.ti_hund );
	timeLine.put ( *(new Time( sample )) );
	cout << ".";
	randomize();
	k = rand();
	for(int j = 0; j < k; ++j )  // Delay loop
	     {
	     cout << "";
	     }
	}
    cout << "\nThe timing samples are:\n\n";
    while( !timeLine.isEmpty() )
	{
	Time& sampleTime = (Time&)timeLine.get();
	cout << sampleTime << "\n";
	delete &sampleTime;
	}
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?