Friday, 2 May 2014

Advanced c++ programming

#include<conio.h>
#include<iostream>
#include<windows.h>
#include<color.h>
#include<stdlib.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 boom();
int main()
{
char ch;
lable:
cout<<white;
gotoxy(25,15);
cout<<"press any key to start or 'n' to exit";
ch=getch();
while(ch!='n' && ch!= 'N')
{
boom();
break;
}
if(ch=='n' || ch=='N')
exit(1);

goto lable;
getch();
return 0;
}


void boom()
{ 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<<"*";
//Sleep(50);
system("cls");
   }
   system("cls");

cout<<green<<" ***      ***     **     *** *    ** *  ***        **"<<endl;
cout<<green<<" ***      ***   **  **   **    *  **   *   *      *"<<endl;
cout<<green<<" ***      ***  **    **  **     * **    *    *    * "<<endl;
cout<<blue<<" ************ ********** **     * **    *     *  * "<<endl;
cout<<blue<<" ************ ********** **   *   **   *       **"<<endl;
cout<<blue<<" ***      *** **      ** ** *     ** *         **"<<endl;
cout<<red<<" ***      *** **      ** **       **           * "<<endl;
cout<<red<<" ***      *** **      ** **       **           *"<<endl;
cout<<red<<" ***      *** **      ** **       **           *"<<endl;
}

No comments:

Post a Comment