Twitter Update

Create star run program [C]


First I think is hard to create this program, that simple one. Here we need file header time.h. can be read by yourself. here I use visual studio, where gotoxy function not exist. we must manually create gotoxy function like a coding below :.


#include<stdio.h>
#include<conio.h>
#include<windows.h>
#include<time.h>
void gotoxy(int x,int y)
{ HANDLE hConsoleOutput;
COORD dwCursorPosition;


dwCursorPosition.X =x;
dwCursorPosition.Y =y;
hConsoleOutput=GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleCursorPosition (hConsoleOutput,dwCursorPosition);
}
void main()
{
    int i,a=5;
    printf("\n\n\n");
    for(i=0;i<50;i++)
    {
       
        system("cls");
        gotoxy(a,4);
        printf("*");_sleep(70);
        a++;
    }
    a=5;
    for(i=0;i<10;i++)
    {
        system("cls");
        gotoxy(54,a);
        printf("*");_sleep(70);
        a++;
    }
    a=53;
    for(i=0;i<30;i++)
    {
        system("cls");
        gotoxy(a,14);
        printf("*");_sleep(70);
        a--;
    }
    a=14;
    for(i=0;i<10;i++)
    {
        system("cls");
        gotoxy(24,a);
        printf("*");_sleep(70);
        a--;
    }
    a=23;
    for(i=0;i<20;i++)
    {
        system("cls");
        gotoxy(a,5);
        printf("*");_sleep(70);
        a--;
    }
    a=6;
    for(i=0;i<15;i++)
    {
        system("cls");
        gotoxy(4,a);
        printf("*");_sleep(70);
        a++;
    }
    a=5;
    for(i=0;i<60;i++)
    {
        system("cls");
        gotoxy(a,20);
        printf("*");_sleep(70);
        a++;
    }
    a=19;
    for(i=0;i<15;i++)
    {
        system("cls");
        gotoxy(64,a);
        printf("*");_sleep(70);
        a--;
    }
    a=63;
    for(i=0;i<30;i++)
    {
        system("cls");
        gotoxy(a,5);
        printf("*");_sleep(70);
        a--;
    }
    system("cls");
    gotoxy(25,8);
    printf("//PROGRAM SELESAI.......//");
    gotoxy(25,9);
    printf("//PRESS ANY KEY TO EXIT...//");
    getch();
}       
hopefully can help you :)

0 comments:

Post a Comment

ABOUT ME

IP
Albert Julius. Powered by Blogger.
Copyright © Albert'Blog