📄 07_02.cpp
字号:
// 07_02.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <list>
using namespace std;
#include <time.h>
#include "timer.h"
#define SIZE 200000
int main(int argc, char* argv[])
{
char szCurr[64];
int hour, minute, second;
timer tmCurr; // 用于显示时间
timer tmCounter; // 用于计时
// 显示系统当前的时间
tmCurr.getTimer( szCurr );
printf( "\n program start at: %s", szCurr );
// 初始化链表
list<int> lstValues;
srand( (unsigned)time( NULL ) );
for(int i = 0; i < SIZE; i++){
lstValues.push_back( rand() % SIZE );
}
tmCounter.start(); // 开始计时
lstValues.sort(); // 链表排序
tmCounter.end(); // 结束计时
// 显示排序用时
tmCounter.getTimer(hour, minute, second);
printf("\n sort spend time: %d hour %d minute %d second",
hour, minute, second );
printf("\n press any key to exit...");
getch();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -