📄 demt1_b.cpp
字号:
/*******************************************************
* *
* Program : DEMT1_B Language : Borland C++ *
* *
* Modified : 20 nov 2003 *
* *
* Copyright (c) 1988,2003, ORITECH V 5.1 *
* All rights reserved. *
* *
*******************************************************
* *
* DEMT1_B.CPP Demo EasyTask *
* *
*******************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
#include <conio.h>
#include <string.h>
#include <float.h>
#include <time.h>
#include "etlib.h"
PMultiTask taskclockptr, taskcountptr;
void taskclock(pvoid, pvoid) // task 1
{
char tbuffer[9];
char sb[128];
pausemode(MTT); // save context
window(1,1,80,25);
textbackground(WHITE);
textcolor(LightBlue);
do
{
gotoxy(70,1);
sprintf(sb,"%s",_strtime(tbuffer));
cprintf(sb);
taskdelay(1000);
} while (TRUE);
}
void taskcount(pvoid, pvoid) // task 2
{
long x;
char sb[128];
pausemode(MTT); // save context
textbackground(BLACK);
textcolor(Yellow);
window(20,15,30,20);
x = 0;
do
{
x++;
if ((x%9 == 0) && (x%4 == 0))
{
sprintf(sb,"x=%li\n\r",x);
cprintf(sb);
}
pause();
} while (!kbhit());
killtask(taskclockptr);
}
void main(void)
{
ETKer_Init();
textbackground(BLACK);
textcolor(WHITE);
clrscr();
taskclockptr = newtask(taskclock,8000,1,MT_CHILD,NULL,0,NULL);
taskcountptr = newtask(taskcount,8000,1,MT_CHILD,NULL,0,NULL);
waitnotask();
printf("Program End\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -