#include <stdio.h>
#include <windows.h>
//Defines gotoxy() for ANSI C compilers.
void gotoxy(short x, short y) {
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main ()
{
int x=1, y=1;
int px=0, py=0;
int xplus=1, yplus=1;
int count=0;
for ( ; count < 500; count++ )
{
gotoxy( px, py );
printf( " " );
gotoxy( x, y );
printf( "*" );
Sleep(30);
px = x;
x += xplus;
if ( x > 80 || x < 1 )
{
xplus *= -1 ;
x += xplus;
}
py = y;
y += yplus;
if ( y > 25 || y < 1 )
{
yplus *= -1 ;
y += yplus;
}
}
}
#include <windows.h>
//Defines gotoxy() for ANSI C compilers.
void gotoxy(short x, short y) {
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main ()
{
int x=1, y=1;
int px=0, py=0;
int xplus=1, yplus=1;
int count=0;
for ( ; count < 500; count++ )
{
gotoxy( px, py );
printf( " " );
gotoxy( x, y );
printf( "*" );
Sleep(30);
px = x;
x += xplus;
if ( x > 80 || x < 1 )
{
xplus *= -1 ;
x += xplus;
}
py = y;
y += yplus;
if ( y > 25 || y < 1 )
{
yplus *= -1 ;
y += yplus;
}
}
}
Sir pwd mangayo ug hint adtung breakdown of numbers?
ReplyDeletewill try...
Delete