Kamis, 07 Juli 2011

Bola Pantul C++

#include<stdio.h>
#include<conio.h>
//#include<dos.h>

void delay(int i) {
int n,m,o;
for(n=0;n<i;n++){
for(m=0;m<i;m++){
for(o=0;o<i;o++) { } } }
}

void main() {
int x=15,y=4,ax=1,by=1;
clrscr();
_setcursortype(_NOCURSOR);
do {
gotoxy(x,y);
printf("hello");
delay(250);
gotoxy(x,y);
printf(" ");
if(x<2 || x>74) {
ax*=-1; //increament or decreament
}
if(y<2 || y>24) {
by*=-1; //increament or decreament
}

x+=ax;
y+=by;
}
while(!kbhit());
}

sumber : http://www.kaskus.us/showthread.php?t=1215259&page=2

1 komentar:

  1. clrscr();
    _setcursortype(_NOCURSOR);
    do {
    gotoxy(x,y)


    kok itu error ya? undefined?

    BalasHapus

Jangan Lupa Kasih Komentar Dan masukannya ya