#include
#include
#define MAX 512
static void pesan1(void);
static void pesan2(void);
static void line(void);
static void delay(void);
static void gotoxy(int x, int y);
int main(int argc, char *argv[]) {
int i;
MessageBox(NULL,"Program Deret Bilangan 18","Answer",MB_ICONINFORMATION | MB_OK);
pesan1();
gotoxy(24,4);
for(i = 1; i <= MAX; i*=2) {
printf("%d ",i);
delay();
}
pesan2();
getche();
MessageBox(NULL,"Terima Kasih Telah Menggunakan Program Ini","Terima Kasih",MB_ICONINFORMATION | MB_OK);
return 0;
}
static void delay(void) {
int delay = 0;
while(delay < 10000000) {
++delay;
}
}
static void pesan1(void) {
int i, len;
char pesan[] = {'S','E','L','A','M','A','T',' ','D','A','T','A','N','G','\0'};
len = strlen(pesan);
gotoxy(18,1);
line();
gotoxy(30,2);
for(i = 0; i < len; i++) {
printf("%c",pesan[i]);
delay();
}
gotoxy(18,3);
line();
}
static void pesan2(void) {
int i, len;
char pesan[] = {'T','E','R','I','M','A',' ','K','A','S','I','H','\0'};
len = strlen(pesan);
gotoxy(18,5);
line();
gotoxy(30,6);
for(i = 0; i < len; i++) {
printf("%c",pesan[i]);
delay();
}
gotoxy(18,7);
line();
}
static void line(void) {
int i;
for(i = 0; i < 20; i++) {
printf("= ");
delay();
}
}
static void gotoxy(int x, int y) {
HANDLE hConsoleOutput;
COORD dwCursorPosition;
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition);
}
Tidak ada komentar:
Posting Komentar