Saturday 24 May 2014

playing with coordinates

#include<conio.h>
#include<iostream>
#include<windows.h>
#include<stdio.h>
void gotoxy(int x,int y)
{
COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
using namespace std;
int main()
{
char name[50];
cout<<"enter your name"<<endl;
gets(name);
for(int i=0;i<strlen(name);i++)
{
for(int j=0;j<5;j++)
{
gotoxy(i,j);
cout<<name[i];
sleep(100);
system("cls");
}
}
puts(name);
getch();
return 0;
}

No comments:

Post a Comment