Hareketli ok

Konu sahibi son olarak 3346 gün önce görüldü
Kod:
#include <stdio.h>
#include <windows.h>
#include <conio.h>  //getch() icin

**** gotoxy(short x, short y)
{
    HANDLE hConsoleOutput;
    COORD Cursor_Pos = {x-1, y-1};

    hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hConsoleOutput, Cursor_Pos);
}
int main()
{
    int y=1;
    int dy=1;
    do{
        gotoxy(40, y);dy>0?printf("V"):printf("A");
        Sleep(50);
        gotoxy(40, y);printf(" ");
        y += dy;
        if(y>23||y<2)
            dy = -dy;

    }while(!kbhit());
}
 
Geri