Rabu, 29 Juni 2016

Contoh 27 (Coding) dan Gambarnya

#include <stdlib.h>
#include "screen.cpp"
#include "keyboard.cpp"
#include "mouse.cpp"
int main(void)
{
Screen *layar = new Screen();
Keyboard *tombol = new Keyboard(layar);
Mouse *tikus = new Mouse();
UCHAR str[5];
USHORT x, y;
layar->setMode(0x03); layar->setCursorPos(4, 14);
tombol->hideCursor();
if (tikus->getState() == MOUSE_NOT_READY)
{
layar->writeString("Mouse tidak siap! Tekan ENTER ...");
tombol->getString(str, 0);
}
tikus->showMouse();
layar->writeString("Klik A, B atau C");
layar->setCursorPos(5, 14);
layar->writeString("[A] Huruf A");
layar->setCursorPos(6, 14);
layar->writeString("[B] Huruf B");
layar->setCursorPos(7, 14);
layar->writeString("[C] Selesasi");
while (TRUE)
{
layar->setCursorPos(9, 14);
if (tikus->getClickMode() == MOUSE_LEFT_CLICK)
{
x = tikus->getX() / 8; /* Periksa posisi horizontal */
y = tikus->getY() / 8; /* Periksa posisi vertikal */
if ((x == 15) && (y == 5))

layar->writeString("Anda memilih A!");
if ((x == 15) && (y == 6))
layar->writeString("Anda memilih B!");
if ((x == 15) && (y == 7)) break;
}
}
delete layar; delete tombol; delete tikus;
return EXIT_SUCCESS;
}


Gambarnya Sebagai Berikut : 


0 komentar:

Posting Komentar

Posting Lama Beranda

Diberdayakan oleh Blogger.

Facebook

Popular Posts

Formulir Kontak

Nama

Email *

Pesan *

Subscribe Here

Ad Home

Random Posts

Recent Posts

Recent

Header Ads

Popular Posts

Flickr

Newsletter

Subscribe Our Newsletter

Enter your email address below to subscribe to our newsletter.

Ad Banner

About Us

Random Posts

Popular Posts

 

Followers

 

Social Share Icons

Templates by Nano Yulianto | CSS3 by David Walsh | Powered by {N}Code & Blogger