#include <iostream>
#include<ctime>
#include<cstdlib>
#include<conio.h>
#include<windows.h>
using namespace std;
class Timer
{
private:
int n;
public:
void gotoxy(int x,int y)
{
HANDLE h;
COORD c;
c.X=x;
c.Y=y;
h=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(h,c);
}
Timer()
{
n=100;
}
void timer()
{
// time_t t;//无符号整数类型
while(true)
{
if(kbhit())
break;
else
{
gotoxy(30,10);
cout<<n;
n++;
}
Sleep(1000);
}
}
};
int main()
{
Timer t;
t.timer();
return 0;
}