yoo kawan-kawan Otaku-it lama gak buat tutor, disini mimin mau share nih cara buat bola pantul aslinya ini tugas kelas tapi gak papa :v selama ada kontent buat post lanjut terus wkwkwk, yuk langsung cek aja scriptnya dibawah ini:
=====================================================================
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <stdlib.h>
//created by Otaku-it
void gotoxy(short x, short y){
COORD pos = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
} //fungsi gotoxy
int main(){
struct _CONSOLE_SCREEN_BUFFER_INFO csbi; //fungsi untuk mengetahui resolusi layar
int max;
int width=0,height=0;
int a=1,b=1;
while(1){
max = GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
gotoxy(width,height);
putchar(48);
width = width + a;
if(width > csbi.srWindow.Right - csbi.srWindow.Left - 1 || width < 1) a *= -1;
height = height + b;
if(height > csbi.srWindow.Bottom - csbi.srWindow.Top - 1 || height < 1) b *= -1;
usleep(10000); //untuk menghentikan program selama 0.1 detik
system("cls"); //command untuk menghapus layar perintah "cmd"
}
return 0;
}
=====================================================================
silakan dicoba script diatas jika kurang mengerti bisa comment dibawah ini :v
Selamat mencoba /('-')/\('-')\ admin@z
Selamat mencoba /('-')/\('-')\ admin@z
No comments:
Post a Comment