#include<conio.h>
#include<iostream>
#include<windows.h>
#include<color.h>
#include<stdio.h>
#include<string.h>
using namespace std;
void gotoxy (int x, int y)
{
COORD coord;
coord.X = x; coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void l_to_r(char *s)
{
for(int i=0;i<35;i++)
{
system("cls");
gotoxy(i,10);
puts(s);
Sleep(80);
}
}
void r_to_l(char *s)
{
for(int i=80-strlen(s);i>35;i--)
{
system("cls");
gotoxy(i,10);
puts(s);
Sleep(80);
}
}
void t_to_d(char *s)
{
for(int i=0;i<18;i++)
{
system("cls");
gotoxy(35,i);
puts(s);
Sleep(80);
}
}
void b_to_u(char *s)
{
for(int i=20;i>10;i--)
{
system("cls");
gotoxy(35,i);
puts(s);
Sleep(80);
}
}
void boom(char *s)
{ int i,j,k,l,m,n;
gotoxy(37,23);
cout<<"*";
for(i=-3,j=-3;i<20,j<5;i++,j++)
{
cout<<blue;
gotoxy(37,23-j);
//Sleep(50);
cout<<"*";
cout<<"*";
cout<<yellow;
gotoxy(37,23-j+1);
cout<<"||";
gotoxy(37,23-j+1);
cout<<"\\/";
Beep(150,80);
system("cls");
}gotoxy(37,23-5);
cout<<"**";
for(i=37,j=18,k=37;i>27,j>8,k<47;i--,j--,k++)
{
gotoxy(i,j);
cout<<red<<"*";
gotoxy(k,j);
cout<<"*";
Sleep(100);
system("cls");
}
for(i=27,j=8,k=47,l=8,m=47,n=27;i>19,j>0,k<55,m>39;i--,j--,k++,l++,m--,n++)
{
Beep(350,80);
cout<<yellow;
gotoxy(27,j);
cout<<" *";
gotoxy(i,8);
cout<<"*";
gotoxy(i,l);
cout<<"*";
gotoxy(i,j);
cout<<"*";
gotoxy(47,j);
cout<<" *";
gotoxy(47,l);
cout<<" *";
gotoxy(k,8);
cout<<"*";
gotoxy(k,l);
cout<<"*";
gotoxy(k,j);
cout<<"*";
gotoxy(m,8);
cout<<"*";
gotoxy(27,l);
cout<<" *";
gotoxy(n,l);
cout<<"*";
gotoxy(n,8);
cout<<"*";
gotoxy(n,j);
cout<<"*";
gotoxy(m,j);
cout<<"*";
gotoxy(m,l);
cout<<"*";
system("cls");
}
}
int main()
{
char s1[25];
int ch=1;
cout<<"Enter your name :";
gets(s1);
cout<<"\n choose your option :\n\n1) Left to Right \n2)Right to Left\n3)Top to Down \n4) Bottom to Up \n";
cin>>ch;
switch(ch)
{
case
1:
l_to_r(s1);
boom(s1);
gotoxy(35,10);
puts(s1);
break;
case 2:
r_to_l(s1);
boom(s1);
gotoxy(35,10);
puts(s1);
break;
case 3:
t_to_d(s1);
boom(s1);
gotoxy(35,18);
puts(s1);
break;
case 4:
b_to_u(s1);
boom(s1);
gotoxy(35,10);
puts(s1);
break;
default: {
cout<<"\nPlease enter valid option !";
}
}
getch();
return 0;
}
download color.h file
Download color file before compilation..change extension into (.h) and save it here–> [local disk (c:)/program files/Dev-cpp/minGW32/include]……
Follow my blog with Bloglovin
#include<iostream>
#include<windows.h>
#include<color.h>
#include<stdio.h>
#include<string.h>
using namespace std;
void gotoxy (int x, int y)
{
COORD coord;
coord.X = x; coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void l_to_r(char *s)
{
for(int i=0;i<35;i++)
{
system("cls");
gotoxy(i,10);
puts(s);
Sleep(80);
}
}
void r_to_l(char *s)
{
for(int i=80-strlen(s);i>35;i--)
{
system("cls");
gotoxy(i,10);
puts(s);
Sleep(80);
}
}
void t_to_d(char *s)
{
for(int i=0;i<18;i++)
{
system("cls");
gotoxy(35,i);
puts(s);
Sleep(80);
}
}
void b_to_u(char *s)
{
for(int i=20;i>10;i--)
{
system("cls");
gotoxy(35,i);
puts(s);
Sleep(80);
}
}
void boom(char *s)
{ int i,j,k,l,m,n;
gotoxy(37,23);
cout<<"*";
for(i=-3,j=-3;i<20,j<5;i++,j++)
{
cout<<blue;
gotoxy(37,23-j);
//Sleep(50);
cout<<"*";
cout<<"*";
cout<<yellow;
gotoxy(37,23-j+1);
cout<<"||";
gotoxy(37,23-j+1);
cout<<"\\/";
Beep(150,80);
system("cls");
}gotoxy(37,23-5);
cout<<"**";
for(i=37,j=18,k=37;i>27,j>8,k<47;i--,j--,k++)
{
gotoxy(i,j);
cout<<red<<"*";
gotoxy(k,j);
cout<<"*";
Sleep(100);
system("cls");
}
for(i=27,j=8,k=47,l=8,m=47,n=27;i>19,j>0,k<55,m>39;i--,j--,k++,l++,m--,n++)
{
Beep(350,80);
cout<<yellow;
gotoxy(27,j);
cout<<" *";
gotoxy(i,8);
cout<<"*";
gotoxy(i,l);
cout<<"*";
gotoxy(i,j);
cout<<"*";
gotoxy(47,j);
cout<<" *";
gotoxy(47,l);
cout<<" *";
gotoxy(k,8);
cout<<"*";
gotoxy(k,l);
cout<<"*";
gotoxy(k,j);
cout<<"*";
gotoxy(m,8);
cout<<"*";
gotoxy(27,l);
cout<<" *";
gotoxy(n,l);
cout<<"*";
gotoxy(n,8);
cout<<"*";
gotoxy(n,j);
cout<<"*";
gotoxy(m,j);
cout<<"*";
gotoxy(m,l);
cout<<"*";
system("cls");
}
}
int main()
{
char s1[25];
int ch=1;
cout<<"Enter your name :";
gets(s1);
cout<<"\n choose your option :\n\n1) Left to Right \n2)Right to Left\n3)Top to Down \n4) Bottom to Up \n";
cin>>ch;
switch(ch)
{
case
1:
l_to_r(s1);
boom(s1);
gotoxy(35,10);
puts(s1);
break;
case 2:
r_to_l(s1);
boom(s1);
gotoxy(35,10);
puts(s1);
break;
case 3:
t_to_d(s1);
boom(s1);
gotoxy(35,18);
puts(s1);
break;
case 4:
b_to_u(s1);
boom(s1);
gotoxy(35,10);
puts(s1);
break;
default: {
cout<<"\nPlease enter valid option !";
}
}
getch();
return 0;
}
download color.h file
Download color file before compilation..change extension into (.h) and save it here–> [local disk (c:)/program files/Dev-cpp/minGW32/include]……
Follow my blog with Bloglovin
No comments:
Post a Comment