2.20same2.18,19dorongcanmove
// Bai2_19.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <conio.h>
#include <stdio.h>
#include <math.h>
#include <dos.h>
#include <PCIXP.h>
#define pi 3.14143
void delay(int time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1000;j++);
}
void main()
{
int add=Get_Addr("PCI_ADC");
int time;
char k;
printf("
Chuong trinh tao song vuong co do rong thay doi duoc.");
printf("
Nhan phim 't' de tang do rong xung. Phim 'g' de giam do rong xung.");
printf("
Nhan phim 'Esc' de thoat chuong trinh");
time = 150;
do
{
while(!kbhit())
{
outportb(add+2,0);
outportb(add+3,0);
delay(time);
outportb(add+2,4095);
outportb(add+3,4095>>8);
delay(300-time);
}
k = getch();
if(k=='t'&& time<290)
time = time+5;
if(k=='g'&& time>10)
time = time-5;
}while(k!=27);
}
Bạn đang đọc truyện trên: TruyenTop.Vip