VB Projects

Get all Visual Basic Projects here..

ASP Dot Net Projects

Get all Asp Dot Net Projects.

C++ Projects and Programs

Get all C++ Projects and Programs here...

PHP Projects

Get all PHP Projets here..

JAVA Projects

Get All JAVA Projects here...

Friday, 14 September 2012

C++ Program to define a function and incorporate the array of structures to input and store any 30 records

C++ Program to define a function and incorporate the array of structures to input and store any 30 records

Display the following using functions incorporated through structure definition viz. display of all entered records,sort the records according to the marks in descending order and display of sorted records.



#include<iostream.h>

#include<conio.h>

#include<string.h>

#include<stdio.h>

struct ward

{

char name[20];

float marks;

} stud[5];

void display();

void sort();

void dispsort();

main()

{

clrscr();

// Data entry

clrscr();

cout<<"D A T A : ENTRY PROCESS: Enter 5 Records Initially"<<endl;

for(int i=0;i<5;i++)

{

cout<<"\nEnter name";

cin>>stud[i].name;

cout<<"\nEnter marks";

cin>>stud[i].marks;

}

       clrscr();

       display(); // Call of Function

       // to display data entered.

       cout<<"Press any key to continue";

       getch();

       clrscr();

       sort(); // Call of Function

// to sort data

       clrscr();

       cout<<"Press any key to display ";

       cout<<"the sorted data";

       getch();

       dispsort(); // Call of Function

// to display the sorted data.

       cout<<endl;

       cout<<"Press any key to continue";

       getch();

       return 0;

}

void display() // Definition of the function

// to display the data values.

{

clrscr();

cout<<"DATA LIST AS ENTERED";

cout<<endl;

for(int k=0;k<5;k++)

{

cout<<"NAME OF THE STUDENT IS ";

cout<<stud[k].name;

cout<<endl;

cout<<"HIS MARKS IS ";

cout<<stud[k].marks;

cout<<endl;

cout<<"***************************************";

cout<<endl;

cout<<"***************************************";

cout<<endl;

}

}

void sort() // Definition of the sort function.

{

// sorting done according to marks.

char nam[20];

int mark=0;

for(int r=0;r<4;r++)

{

for(int s=r+1;s<5;s++)

{

if (stud[r].marks < stud[s].marks)

{

strcpy(nam,stud[r].name);

strcpy(stud[r].name,stud[s].name);

strcpy(stud[s].name,nam);

mark=stud[r].marks;

stud[r].marks=stud[s].marks;

stud[s].marks=mark;

}

}

}

}

void dispsort() // Definition of the function

// to print the sorted data.

{

clrscr();

cout<<"Display of sorted data according to marks";

cout<<endl;

display();

cout<<endl;

cout<<"End of data encountered";

cout<<endl;

cout<<"Press any key to continue";

getch();

}

C++ Program to sort the given strings in Ascending order

C++ Program to sort the given strings in Ascending order

#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
clrscr();
char name[10][20],temp[10][20];
int i,j,n;
printf ("\nENTER THE NUMBER OF NAMES TO BE ASCENDED : ");
scanf ("%d",&n);
for (i=0;i<n;i++)
{
printf ("ENTER THE %d NAME : ",i+1);
scanf ("%s",name[i]);
}
printf ("\n The ascending order of the names is : \n ");
for (i=0;i<n;i++)
{
for (j=i+1;j<n;j++)
{
if (strcmp(name[i],name[j])>0)
{
strcpy (temp[i],name[i]);
strcpy (name[i],name[j]);
strcpy (name[j],temp[i]);
}
}
printf ("\n%s",name[i]);
}
getch();
}

C++ Program to input a string and a character. Print the frequency of the character within the string

C++ Program to input a string and a character. Print the frequency of the character within the string

 #include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<stdio.h>
main()
{
clrscr();
char name[40],input;
int l=0,count=0;
cout<<"Enter any word "<<endl;
gets(name);
cout<<endl<<"Enter the character to print the frequency";
cin>>input;
l = strlen(name);
cout<<endl;
for (int a=0;a<l;a++)
{
if (name[a]==input) count = count + 1;

}
cout<<endl<<"The frequency of "<<input<<" is "<<count<<endl;
getch();
return 0;
}

C++ Program to input any string and print the number of 'the'

C++ Program to input any string and print the number of 'the'

 #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
clrscr();
char name[50];
int l=0,c=0;
cout<<"Enter any string "<<endl;
gets(name);
l = strlen(name);
cout<<endl;
for(int i=0;i<=l;i++)
{
if ((name[i]=='t') && (name[i+1]=='h') && ((name[i+2])=='e'))
c=c+1;}
cout<<endl;
cout<<"total the is "<<c;
getch();
return 0;

}

C++ Program to input any ten numbers and print them in ascending order

C++ Program to input any ten numbers and print them in ascending order

 #include<iostream.h>
#include<conio.h>
main()
{
int number[10],a,b,c,d;
clrscr(); // clear the screen
cout<<"Enter the elements of the array"<<endl;
for(int i=0;i<10;i++)
{
cout<<"Enter number for cell "<<i<<endl;
cin>>number[i];
}
cout<<endl<<"Thank You ! The data entry is over"<<endl;
cout<<"Press any key to continue";
getch();
clrscr();
// sorting of data
for(int j=0;j<9;j++)
{
for(int k=j+1;k<10;k++)
{
if (number[j]>number[k])
{
a=number[j];
number[j]=number[k];
number[k]=a;
}
}
}
cout<<"The list in ascending order is ";
cout<<endl;
for(i=0;i<10;i++)
cout<<number[i]<<"\t";
cout<<endl<<"Press any key to return to the editor";
getch();
return 0;
}

C++ Program using function allows the user to enter a number and than rounds it off,correct to the nearest integer

C++ Program using function allows the user to enter a number and than rounds it off,correct to the nearest integer


#include <iostream.h>
#include <conio.h>             //HEADER FILES


void main()                  // MAIN FUNCTION

    {
     clrscr();                // CLEAR THE SCREEN

     float input=0,remainder=0;    // INITIALIZATION AND DECLARATION OF
     int whole=0,answer=0;        // VARIABLES

     gotoxy (15,15);                        // GO TO A PARTICULAR POSITION

     cout << "ENTER A FLOAT NUMBER : ";     // MESSAGE

     cin >> input;            // STORE THE INPUT INTO THE VARIABLE

     whole = input;        // THIS LINE STORES THE INTEGER PART OF THE VALUE
               // INTO A SEPERATE VARIABLE

     remainder = input - whole;   // REMAINDER IS THE VALUE AFTER THE DECIMAL
                 // POINT

     if (remainder >= 0.5)       // IF REMAINDER IS GREATER THAN 0.5

    answer = whole + 1;     // ADD 1 TO THE VALUE

     else                      // OTHERWISE

    answer = whole;      // KEEP THE INTEGER PART AS IT IS

     gotoxy (15,16);
     cout << "Rounded Off Number Is : " << answer;  // DISPLAY THE ANSWER

     getch();               // WAIT FOR AN INPUT FROM THE USER.

    }      // END OF FUNCTION

C++ Program to Rotates a word

C++ Program to Rotates a word
This program prints all the rotation of a word.
Say if the input word is "space", then it prints
>>space
>>paces
>>acesp
>>cespa

>>espac

 #include <stdio.h>
#include <string.h>
#include <conio.h>
void main()
{
char w[50],buf[50],temp[50],buf2[10];
clrscr();
printf("Enter a word to see it's rotation :");
fflush(stdin);
gets(w);
strcpy(temp,w);
printf("All the rotation of the word \"%s\" are :",w);
for(int i=0;i<strlen(w);i++)
{
strcpy(buf,strnset(w,' ',i));
for(int j=0;j<i;j++)
buf2[j]=temp[j];
buf2[j]='\0';
strcat(buf,buf2);
//To straighten the output
gotoxy(strlen(w)-i,4+i);
puts(buf);
}
getch();
}

C++ Program to input any string and print the number of words

C++ Program to input any string and print the number of words

 #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
char a,name[50];
int l=0,c=0,word=0;
cout<<"Enter any string "<<endl;
gets(name);
l = strlen(name);
cout<<endl;
for(int i=0;i<l;i++)
{
a=name[i];
if (a==' ') c = c + 1;
}
word = c + 1;
cout<<"The total number of words in the string is "<<word;
cout<<endl;
getch();
return 0;

}

C++ Program to delete the first common word in two strings and display the strings without the first common words

C++ Program to delete  the first common word in two strings and display the strings without the first common words

#include <conio.h>
#include <stdio.h>
#include <iostream.h>

char string1[25] = {'\0'};
char string2[25] = {'\0'};
char temp[25] = {'\0'};

int start = -1;
int end = -1;

int start2 = 0;
int end2 = 0;


/*GET THE INPUT FOR THE STRINGS*/
void get_input()
{
    cout << "Enter the first string : ";
    gets(string1);

    cout << "Enter the second string : ";
    gets(string2);
}


/*SET INDEXES FOR ALIAS WORD*/
void extract_word()
{
    while( string2[end2] != ' ' )
        end2++;
}


/*COMPARE THE TWO WORDS*/
int compare()
{
    int n;

    for(n=start; n<end; n++)
    {
        if( string2[n-start] != string1[n] )
        {
            return 0;
        }
    }
    return 1;
}


/*FIND THE ALIAS WORD IN THE STRINGS*/
void find_alias()
{
    int same = 0;

    while( (same != 1) && (string1[end] != '\0') )
    {
        end++;
        start = end;

        while( (string1[end] != ' ') && (string1[end] != '\0') )
            end++;

        same = compare();
    }

}

/*REPLACE THE WORD*/
void replace_alias()
{
    int counter = end;

    /*find the end of the string*/
    while( string1[counter] != '\0' )
        counter++;

    /*copy the remaining string to temp*/
    for(int i=end; i<counter; i++)
    {
        temp[i-end] = string1[i];
    }

    counter = start;

    /*nullify the remaining string*/
    while( string1[counter] != '\0' )
    {
        string1[counter] = '\0';
        counter++;
    }

    start2 = end2;
    counter = start-1;

    /*replace the alias by the second string*/
    while( string2[end2] != '\0' )
    {
        string1[counter] = string2[end2];
        end2++;
        counter++;
    }

    int k = 0;

    /*copy the remaining string back from temp*/
    while( temp[k] != '\0' )
    {
        string1[counter] = temp[k];
        k++;
        counter++;
    }
}


void main()
{
    clrscr();

    get_input();
    extract_word();
    find_alias();
    replace_alias();

    cout << string1 << '\n';

    getch();
} 

C++ Program to implement a Recursive Function

C++ Program to implement a Recursive Function


 #include <iostream.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
void recurfunc(int start,int stop,char* buff);
void main()


    {   clrscr();
    cout << "enter how many times to loop: ";
    char buff[100];
    cin >> buff;
    int num;
    num = atoi(buff);
    if(num >= 1)


        {
            recurfunc(0,num," this is a recursive function");
        }
        else


        {
            cout << "sorry you didnt enter valid data" << endl;
            return;
        }
        getch();
    }
    void recurfunc(int start,int stop,char* buff)


        {
        if(start < stop)


            {
                start++;
                cout << "\n" << buff << "\n";
                recurfunc(start,stop,buff);
            }
            else


            {
                return;
            }
        }

C++ Program to Print out a diamond of any size less than 12

C++ Program to  Print out a diamond of any size less than 12


#include <iostream.h>
#include <conio.h>
const int Center = 20;

void printnc(char c, int n){
    for (int lcv=0; lcv < n; lcv++)
    {
    cout << c;
    }
}

// Print out a triangle of size n
void printTriangle(int n){

   for (int i=0; i < n; i++){
       printnc(' ', Center - i -1);
       printnc('X', 2*i+1);
       cout << endl;
   }
}

// Print reverse of triangle printed by printTriangle
void printRTriangle(int n){

   for (int i=0; i < n; i++){
       printnc(' ', Center - n + i);
       printnc('X', 2*n-2*i-1);
       cout << endl;
   }
}


// Get dimension of triangle from user
void main(void){
   int m;

   cout << "Enter an integer m [0 < m < 12]: "; endl;
   cin >> m;
   while ((m > 0) && (m < 12)){
      printTriangle(m);
      printRTriangle(m-1);
      cout << "Enter an integer m [0 < m < 12]: ";
      cin >> m;
   }
}

C++ Program to print out a checkered board of size n

C++ Program to print out a checkered board of size n

 #include <iostream.h>
#include <conio.h>

const int cellSize = 4;
void printnc(char c, int n){
   for(int k = 0; k<n; ++k)
      cout << c;
}

void printBWcells(void){
   printnc('.', cellSize);
   printnc(' ', cellSize);
}

void printWBcells(void){
   printnc(' ', cellSize);
   printnc('.', cellSize);
}

void printBoard(int n){
   printnc('*', 2+2*n*cellSize);
   cout << endl;
   for(int k = 0; k<n; ++k){
      for(int h = 0; h < cellSize; ++h){
     cout << '*';
     for(int m=0; m<n; ++m){
        if((k%2)==0)
          printBWcells();
        else
          printWBcells();
     }
     cout << '*' << endl;
      }
   }
   printnc('*', 2+2*n*cellSize);
   cout << endl;
}

void main(void){
   int n;
   clrscr();

   cout << "Enter size of board: ";
   cin >> n;
   clrscr();

   printBoard(n);
   cout<<endl;
   cout<<"Press any key to continue";
   getch();
}

C++ Program to play a puzzle

C++ Program to play a puzzle


#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<stdio.h>
getkey1()
{union REGS i,o;
while(!kbhit());
i.h.ah=0;
int86(22,&i,&o);
return(o.h.ah);
}
void main2()
{int gd=DETECT,gm,i,j,n=0,m,q=0,v=0,k;
char *a[16]={"9","3","2","4","7","6","5","8","1","11" ,"13","12","10","14"," " ,"15"}

,*b[16]={"1","2","3","4","5","6","7","8","9","10" ,"11","12","13","14","15" ," "},*t;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setcolor(3);
outtextxy(260,100," PUZZLE");
setcolor(4);
setcolor(WHITE);
delay(2000);
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,a[n]);
n++;
}
do{{ setcolor(3);
outtextxy(100,170,"YOU HAVE TO SOLVE IT WITHIN 400 MOVES");

setcolor(8);
outtextxy(280,130,"LEVEL: 2 ");
setcolor(9);
outtextxy(100,150,"YOU HAVE SPENT ");
//outtextxy(220,150,v);
gotoxy(28,10);
cout<<v;
outtextxy(240,150," MOVES ");
setcolor(2);
outtextxy(100,330,"USE ARROW KEYS FOR DIRECTION");
setcolor(4);
outtextxy(200,350,"PRESS '* ' TO QUIT AT ANY TIME");
setcolor(5);
outtextxy(400,50,"ARRANGE LIKE THIS");
m=0;
for(i=425;i<=500;i+=25)
for(j=60;j<=135;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,b[m]);
m++;
}
}
setcolor(WHITE);
if((*a[0]=='1')&&(*a[1]=='2')&&(*a[2]=='3')&&(*a[3]=='4')&&(*a[4]=='5')&&(*a[5]=='6')&&(*a[6]=='7')&&(*a[7]=='8')
&& (*a[8]=='9')&&(strcmp(a[9],"10")==0)&&(strcmp(a[10],"11")==0)&&(strcmp(a[11],"12")==0)&&(strcmp(a[12],"13")==0)&&(strcmp(a[13],"14")==0)&&(strcmp(a[14],"15")==0))

{setcolor(5);
outtextxy(200,350,"CONGRATULATION! YOU WIN");
getch();
break;
}
k=getkey1();
sound(500);
delay(100);
nosound();
switch(k)
{case 75:{clearviewport();
n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&(n<=11)&&(q==0))
{t=a[n];
a[n]=a[n+4];
a[n+4]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,a[n]);
n++;
}
q=0; break;
}
case 77:{clearviewport();
n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&(n>3)&&(q==0))
{t=a[n];
a[n]=a[n-4];
a[n-4]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,a[n]);
n++;
}
q=0;break;
}
case 80: {clearviewport();
n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&((n!=0)&&(n!=4)&&(n!=8)&&(n!=12))&&(q==0))
{t=a[n];
a[n]=a[n-1];
a[n-1]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,a[n]);
n++;
}
q=0;break;
}
case 72:{clearviewport();
n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&(n!=3)&&(n!=7)&&(n!=11)&&(n!=15)&&(q==0))
{t=a[n];
a[n]=a[n+1];
a[n+1]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=250;i<=325;i+=25)
for(j=200;j<=275;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,a[n]);
n++;
}
q=0; break;
}
}}while((k!=55)&&(v<=400));
if(v>400) {outtextxy(200,350,"SORRY! YOUR MOVE IS OVER");
getch();
}
closegraph();
}

//puzz6.cpp ends here.





#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<stdio.h>
getkey()
{union REGS i,o;
while(!kbhit());
i.h.ah=0;
int86(22,&i,&o);
return(o.h.ah);
}
void main()
{int gd=DETECT,gm,i,j,n=0,m,q=0,v=0,k;
char *a[9]={"7","2","5","4","3","6","1"," ","8"}

,*b[9]={"1","2","3","4","5","6","7","8"," "},*t;
initgraph(&gd,&gm,"..//bgi");
setcolor(3);
outtextxy(260,100," PUZZLE");
setcolor(4);
setcolor(WHITE);
delay(2000);
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,a[n]);
n++;
}
do{{ setcolor(3);
outtextxy(100,170,"YOU HAVE TO SOLVE IT WITHIN 200 MOVES");
setcolor(1);
outtextxy(210,130,"LEVEL : 1");
setcolor(9);
outtextxy(100,150,"YOU HAVE SPENT ");
//outtextxy(220,150,v);
gotoxy(28,10);
cout<<v;
outtextxy(240,150," MOVES ");

setcolor(2);
outtextxy(100,330,"USE ARROW KEYS FOR DIRECTION");
setcolor(4);
outtextxy(100,350,"PRESS '* ' TO QUIT AT ANY TIME");
setcolor(5);
outtextxy(400,50,"ARRANGE LIKE THIS");
m=0;
for(i=425;i<=475;i+=25)
for(j=60;j<=110;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+8,j+10,b[m]);
m++;
}
}
setcolor(WHITE);
if((*a[0]=='1')&&(*a[1]=='2')&&(*a[2]=='3')&&(*a[3]=='4')&&(*a[4]=='5')&&(*a[5]=='6')&&(*a[6]=='7')&&(*a[7]=='8'))

{setcolor(5);

outtextxy(180,380,"CONGRATULATION! YOU FINISHED LEVEL 1");
getch();
clearviewport();
main2();
break;
}
k=getkey();
sound(300);
delay(100);
nosound();
switch(k)
{case 75:{clearviewport();
n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&(n<=5)&&(q==0))
{t=a[n];
a[n]=a[n+3];
a[n+3]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+10,j+10,a[n]);
n++;

}
q=0; break;
}
case 77:{clearviewport();
n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&(n>=2)&&(q==0))
{t=a[n];
a[n]=a[n-3];
a[n-3]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+10,j+10,a[n]);
n++;
}
q=0;break;
}
case 80: {clearviewport();
n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&((n!=0)&&(n!=3)&&(n!=6))&&(q==0))
{t=a[n];
a[n]=a[n-1];
a[n-1]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+10,j+10,a[n]);
n++;
}
q=0;break;
}
case 72:{clearviewport();
n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
if ((*a[n]==' ')&&((n!=2)&&(n!=5)&&(n!=8))&&(q==0))
{t=a[n];
a[n]=a[n+1];
a[n+1]=t;
q=1;
v++;
}
n++;
} n=0;
for(i=200;i<=250;i+=25)
for(j=200;j<=250;j+=25)
{rectangle(i,j,i+25,j+25);
outtextxy(i+10,j+10,a[n]);
n++;
}
q=0; break;
}
}}while((k!=55)&&(v<=200));
if(v>200) {outtextxy(200,350,"SORRY! YOUR MOVE IS OVER");
delay(2000);
getch();
}
closegraph();
}

C++ Program for converting an int variable to floating point

C++ Program for converting an int variable to floating point

#include <iostream.h>
#include <stdlib.h>      //defines EXIT_SUCCESS etc
#include <conio.h>

int main( void )
{
  // declare variables here

    int x,y;
    float quotient;
    cout <<"enter an integer x="; cin >> x;
    cout <<"enter an integer y="; cin >> y;

    quotient= x / y;
    cout<< "x / y is " << quotient << endl;

    quotient= float(x) / y;
    cout<< "float(x) / y is " << quotient << endl;
    getch();


  return EXIT_SUCCESS;
}


C++ Program to print the product of two matrices

C++ Program to print the product of two matrices


#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int i,j,a[3][4],b[4][3],c[3][3];
//Creation of matrix A[3][4]
cout<<"Enter elements of array A"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
cin>>a[i][j];
}
}
cout<<"Enter elements of array B"<<endl;
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}
// storing product in array C
for (i=0;i<3;i++)
{
for (j=0;j<3;j++)
{
c[i][j]=0;
for(int k=0;k<4;k++)
{
c[i][j]=a[i][k]*b[k][j]+c[i][j];
}
}
}
cout<<endl<<"The matrix A is "<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
cout<<a[i][j]<<" ";
}
cout<<endl;
}
cout<<endl<<"The matrix B is "<<endl;
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
cout<<b[i][j]<<" ";
}
cout<<endl;
}
cout<<endl<<"The matrix C is "<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<c[i][j]<<" ";
}
cout<<endl;
}

getch();
return 0;
}

C++ Program to assign string in a double dimensional array and display the contents

C++ Program to assign string in a double dimensional array and display the contents


 #include <iostream.h>
#include <conio.h>


enum {NAMESIZE=20};

// Print out the first n names of a
void printNames(char a[][NAMESIZE], int n)
{
    for (int row=0; row<n; row++)
    {
        for (int clmn=0; a[row][clmn] != '\0'; clmn++)
        {
            cout << a[row][clmn];
        }
        cout << endl;
    }
}

// Print out the first n names of a
void printNames(char *a[], int n)
{
    for (int k=0; k<n; k++)
    {
        cout << a[k] << endl;
    }
}

void main(void)
{
    char names1[][NAMESIZE] = {"ankur", "rose", "simran", "gauri"};
    char *names2[] = {"lallan", "ballan", "sonal", "monika"};

    cout << "The size of names1 is " << sizeof(names1) << endl;
    cout << "The size of names2 is " << sizeof(names2) << endl;
    getch();


    cout << endl << "Printing out: char names1[][NAMESIZE]" << endl;
    printNames(names1, 4);

    cout << endl << "Printing out: char *names[]" << endl;
    printNames(names2, 4);
    getch();

    cout << endl << "Printing out: names1[row]" << endl;
    for (int row=0; row < 4; row++)
    {
        cout << names1[row] << endl;
    }

    cout << endl << "Printing out: names2[row]" << endl;
    for (row=0; row < 4; row++)
    {
        cout << names2[row] << endl;
    }

    getch();clrscr();
}

C++ program to calculates the value of a polynomial

C++ program to calculates the value of a polynomial

 #include <iostream.h>
#include <conio.h>
#include <process.h>

const int MAXDEGREE = 10;    // define constant

void main() 
{
   float x, y;
   float coefficients[MAXDEGREE+1];  // coefficients of a polynomial
   float x_powers[MAXDEGREE+1];      // powers of x
   int degree, i;

   cout << "\nCalculation of polynomial";
   cout << "\nEnter degree ";
   cin >> degree;
   if (degree > MAXDEGREE || degree < 0)
   {
      cout << "\nError";  getch(); exit(0);
     }

   // read coefficients, highest first:
   for (i = degree;  i >= 0;  i--)
   {
      cout << "\nEnter coefficient " << i << " ";
      cin >> coefficients[i];
   }

   // read x:
   cout << "\nEnter x ";
   cin >> x;

   // calculate powers of x
   x_powers[0] = 1;
   for (i=1;  i <= degree;  i++)
   {
      x_powers[i] = x_powers[i-1] * x;
   }

   // calculate polynomial
   y = 0;
   for (i = 0;  i <= degree;  i++)
   {
      y = y + coefficients[i] * x_powers[i];
   }

   // write result
   cout << "\n\nResult is " << y;

   // wait for key pressure and exit
   getch();
}

C++ Program for Pig Latin Converter

C++ Program for  Pig Latin Converter


#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>

int makePhrase(char * word, char phrase[][20]);

void main()
{
clrscr();
   char word[30] = {'\0'};
   char phrase[20][20];
   char convert[30] = {'\0'};
   char temp[10] = {'\0'};
   int counter =0;
   int check = 0;
   int firstvowel = 0;
   int i;
   int numcons;

   cout<<"Please enter a word or phrase up to 30 characters"<<endl;
   cin.getline(word,30,'\n');
   strlwr(word);
   cout<<"\nYour entry was '"<<word<<"'"<<endl;
   cout<<"---------------------------"<<endl;

   i=makePhrase(word,phrase);

   for (int k=0; k<i; k++)
   {
   int size = strlen(phrase[k]);

   for(int j=0;j<size;j++)
      {

      switch(phrase[k][j])
      {
      case 'a':
     if (j == 0)
        firstvowel = 1;

     check = 1;
     break;
      case 'e':
     if (j == 0)
        firstvowel = 1;

     check = 1;
     break;
      case 'i':
     if (j == 0)
        firstvowel = 1;

     check = 1;
     break;
      case 'o':
     if (j == 0)
     firstvowel = 1;

     check = 1;
     break;
      case 'u':
     if (j == 0)
        firstvowel = 1;

     check = 1;
     break;
      default:
     if (check != 1 && firstvowel != 1)
     counter++;
     break;


      }


   };
      if (firstvowel == 1)
      {
      strcat(phrase[k],"hay");
      cout<<"Word begins with a vowel, no need for movement"<<endl;
      cout<<"Your word in Pig Latin is\n"<<phrase[k]<<endl;
      cout<<"---------------------------"<<endl;
      }

      else
      {
      numcons = counter-1;
      cout<<"The first vowel is: "<<phrase[k][counter]<<endl;
      cout<<"The letter(s) to move is:"<<endl;

      do
      {                               cout<<phrase[k][numcons]<<endl;
                temp[numcons] = phrase[k][numcons];
      numcons-=1;
      }while(numcons !=-1);

      int leftover = strlen(phrase[k]) - numcons;

      for(int i=0; i<leftover; i++)

      {
      convert[i] = phrase[k][counter];
      counter+=1;
      };
      strcat(convert, temp);
      strcat(convert, "ay");
      strcpy(phrase[k],convert);
cout<<"Your word in Pig Latin is:\n"<<phrase[k]<<endl;
cout<<"---------------------------"<<endl;
   };
   numcons=0;
   counter=0;
   firstvowel=0;
   size=0;
   check = 0;
   strcpy(temp,"0");
   };



        cout<<"\n\nYour translated entry:\n";
   cout<<"--------------\n";
   for(int a=0;a<i;a++)
   {
      cout<<phrase[a]<<" ";
   };
   cout<<"\n--------------"<<endl;
};

int makePhrase(char * word, char phrase[][20])
{
int i=0;
char *space = " ";
char *breaker;
breaker = strtok(word,space);
   while ( breaker )
   {
   strcpy( phrase[i],breaker );
   breaker = strtok( NULL, space );
    i++;
   };
   return i;
};

C++ Program to input any string and print the number of spaces stored within the string at prime positions

C++ Program to input any string and print the number of spaces stored within the string at prime positions

 #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
main()
{
char a,name[50];
int f=0, l=0,c=0,k=0;
cout<<"Enter any string "<<endl;
gets(name);
l = strlen(name);
cout<<"The length of the string is "<<l;
cout<<endl;
for(int i=0;i<l;i++)
{
a=name[i];
if (a==' ')
// checking if i is prime
k=i+1;
for(int l=1;l<=k;l++)
{
if (k%l==0)
f=f+1;
}
if (f==2)
c = c + 1;
f=0;
}
cout<<endl<<"The no. of spaces at prime position is  "<<c;
getch();
return 0;

}

C++ Program to display a Triangle of numbers called the Pascal's Triangle

C++ Program to  display a Triangle of numbers called the Pascal's Triangle, when provided with  the number of rows

 # include <stdio.h>
#include<conio.h>
void main ()
{
int pal[50][50];
int i,j,k,n;
printf("ENTER THE NUMBER OF ROWS : ");
scanf("%d",&n);
for (i=0;i<n;i++)
{
pal[i][0]=1;
pal[i][i]=1;
for (j=1;j<i;j++)
{
pal[i][j]=pal[i-1][j-1]+pal[i-1][j];
}
for (j=1;j<=(n-(i+1));j++)
{
printf (" ");
}
for (k=0;k<=i;k++)
{
printf(" %2d ",pal[i][k]);
}
printf("\n");
}
getch();
}

C++ Program to display all prime fibonacci series within the range of 1 to 10000

C++ Program to display all prime fibonacci series within the range of 1 to 10000

#include<conio.h>
#include<iostream.h>
#include<stdio.h>
int isprime(int);
main()
{
clrscr();
cout<<"All prime fibonacci series in the range of 1 to 10000 are"<<endl;
int r;
int a=1,b=2,c=0;
r=isprime(a);
if (r==1) cout<<a<<" ";
r=isprime(b);
if (r==1) cout<<b<<" ";
while (c<=10000)
{
c=a+b;
r=isprime(c);
if ((r==1) && (c<=10000))
cout<<c<<" ";
a=b;
b=c;
}
getch();
}
int isprime(int x)
{
int i;
if (x==1) return 0;
else
{
int p=1;
for(i=2;i<x;i++)
{
if (x%i==0)
p=2;
}
return (p);
}
} 

C++ Program to Conversion program using Fucntions

C++ Program to Conversion program using Fucntions

#include <iostream.h>
#include <stdlib.h>

char choosestd;
float inch1;
float inch2;
float foot;
float yard;
float mile;
float millimeter;
float centimeter;
float meter1;
float meter2;
float kilometer;

int first;
float firstfunction();
float secondfunction();
float thirdfunction();
float fourthfunction();
float fifthfunction();
float sixthfunction();
float seventhfunction();
float eigthfunction();
float ninthfunction();
float tenthfunction();


int main()
{
      clrscr();
      cout << "*-------------------------------------------------------------*\n";
      cout << " \n\n\n";
      cout << "To (q)uit any time type enter \"q\"\n\n";
      cout << "To convert from Standard Measurments to Metric enter \"1\": \n";
      cout << "To convert from Metric to Standard Measurments enter \"2\": \n";
      cin >> first;

if (first == 1)
{
      int choosestd;
      cout << "What would you like to convert?\n";
      cout << "(1)Inches to Millimeters: \n";
      cout << "(2)Inches to Centimeters: \n";
      cout << "(3)Feet to Meters: \n";
      cout << "(4)Yards to Meters: \n";
      cout << "(5)Miles to Kilometers: \n";
      cin >> choosestd;

if (choosestd == 1)
     {
      cout << "\nEnter the number of inches you wish converted: \n";
      cin >> inch1;

      cout << "You entered " << inch1 ;
      cout<< " inches, which equals " << firstfunction() << " millimeters.\n\n";

      system("PAUSE");
      return main();
      }

else if     (choosestd == 2)
      {
      cout << "\nEnter the number of inches you wish converted: \n";
      cin >> inch2;

       cout << "You entered " << inch2 << " inches, which equals " << secondfunction() << " centimeters.\n\n";

      system("PAUSE");
      return main();
      }
else if     (choosestd == 3)
      {
      cout << "\nEnter the number of feet you wish converted: \n";
      cin >> foot;

      cout << "You entered " << foot << " feet, which equals " << thirdfunction() << " meters.\n\n";

      system("PAUSE");
      return main();
      }
else if     (choosestd == 4)
      {
      cout << "\nEnter the number of yards you wish converted: \n";
      cin >> yard;

      cout << "You entered " << yard << " yards, which equals " << fourthfunction() << " meters.\n\n";

      system("PAUSE");
      return main();
      }
else if     (choosestd == 5)
      {
      cout << "\nEnter the number of miles you wish converted: \n";
      cin >> mile;

      cout << "You entered " << mile << " miles, which equals " << fifthfunction() << " kilometers.\n\n";

      system("PAUSE");
      return main();
      }
else if ((choosestd != 1) || (choosestd !=2) || (choosestd !=3) || (choosestd !=4) || (choosestd !=5))
      {
      cout<<endl;
      cout << "\n\nThank you for using this program.\n\n";
      cout<<"endl";
      getch();

      return 0;
      }
}

else if (first == 2)
{
      int choosestd;
      cout << "What would you like to convert?\n";
      cout << "(1)Millimeters to Inches: \n";
      cout << "(2)Centimeters to Inches: \n";
      cout << "(3)Meters to Feet: \n";
      cout << "(4)Meters to Yards: \n";
      cout << "(5)Kilometers to Miles: \n";
      cin >> choosestd;

if (choosestd == 1)
     {
      cout << "\nEnter the number of millimeters you wish converted: \n";
      cin >> millimeter;

      cout << "You entered " << millimeter << " millimeters, which equals " << sixthfunction() << " inches.\n\n";

      system("PAUSE");
      return main();
      }

else if     (choosestd == 2)
      {
      cout << "\nEnter the number of centimeters you wish converted: \n";
      cin >> centimeter;

       cout << "You entered " << centimeter << " centimeters, which equals " << seventhfunction() << " inches.\n\n";

      system("PAUSE");
      return main();
      }
else if     (choosestd == 3)
      {
      cout << "\nEnter the number of meters you wish converted: \n";
      cin >> meter1;

      cout << "You entered " << meter1 << " meters, which equals " << eigthfunction() << " feet.\n\n";

      system("PAUSE");
      return main();
      }
else if     (choosestd == 4)
      {
      cout << "\nEnter the number of meters you wish converted: \n";
      cin >> meter2;

      cout << "You entered " << meter2 << " meters, which equals " << ninthfunction() << " yards.\n\n";

      system("PAUSE");
      return main();
      }
else if     (choosestd == 5)
      {
      cout << "\nEnter the number of kilometers you wish converted: \n";
      cin >> kilometer;

      cout << "You entered " << kilometer << " kilometers, which equals " << tenthfunction() << " miles.\n\n";

      system("PAUSE");
      return main();
      }
else if ((choosestd != 1) || (choosestd !=2) || (choosestd !=3) || (choosestd !=4) || (choosestd !=5))
      {
      int x;
      cout << "\n\nThank you for using this program.\n\n";
      cin >> x;

      return 0;
      }

}



else if ((first != 1) || (first != 2))
{
      int x;
      cout << "End Program.\n\n\nThis program was brought to you by\n             http://www.mcarterbrown.com\n\n\n";
      cout << "Thank you\n\n\n";
      cin >> x;

      return 0;
}

}
float firstfunction()
      {
      double x;
      x = (inch1 * 25.4);
      return x;
      }
float secondfunction()
      {
      double x;
      x = (inch2 * 2.54);
      return x;
      }
float thirdfunction()
      {
      float x;
      x = (foot * .3048);
      return x;
      }
float fourthfunction()
      {
      float x;
      x = (yard * .9144);
      return x;
      }
float fifthfunction()
      {
      float x;
      x = (mile * 1.609);
      return x;
      }
float sixthfunction()
      {
      float x;
      x = (millimeter / 25.4);
      return x;
      }
float seventhfunction()
      {
      float x;
      x = (centimeter / 2.54);
      return x;
      }
float eigthfunction()
      {
      float x;
      x = (meter1 / .3048);
      return x;
      }
float ninthfunction()
      {
      float x;
      x = (meter2 / .9144);
      return x;
      }
float tenthfunction()
      {
      float x;
      x = (kilometer / 1.609);
      return x;
      }

Thursday, 13 September 2012

C++ Program to design a Five Function Calculator using Switch/Case

C++ Program to design a Five Function Calculator using Switch/Case

 #include <iostream.h>
#include <conio.h>
int main () {
main:
    int a,b,c,d,ans;
    double v1, v2, ans2;
    char yn;
    while (yn != 'n')
    {
    clrscr();
    cout<<"\n\n\n\t-_-_-_-_-_-_-_-_-  Five Function Calculator   _-_-_-_-_-_-_-_-_\n\n";
    cout<<"Select the operation .\n";
    cout<<"1. Multipication\n";
    cout<<"2. Division\n";
    cout<<"3. Subtraction\n";
    cout<<"4. Addition\n";
    cout<<"5. Power\n";
    cout<<"6. Exit\n";
    cout<<"Enter a number: [1-6]";
    cin>>ans;
    switch (ans) {
    case 1:
        goto multipication;
        break;
    case 2:
        goto division;
        break;
    case 3:
        goto subtraction;
        break;
    case 4:
        goto addition;
        break;
    case 5:
        goto power;
        break;
    case 6:
        cout<<"Thank You\n";
        return 0;

    }

multipication:
    cout<<"\n\t\t==================Multipication===============\n";
    cout<<"Enter your First Number: ";
    cin>>v1;
    cout<<"Enter your Second Number: ";
    cin>>v2;
    ans2=v1 * v2;
    cout<<"Answer: "<<ans2<<"\n\n";
    cout<<"Would like to solve another one <yn>: ";
    cin>>yn;
    goto main;
    return 0;

division:
    cout<<"\n\t\t==================Division===============\n";
    cout<<"Enter your First Number: ";
    cin>>v1;
    cout<<"Enter your Second Number: ";
    cin>>v2;
    if (v2==0) {
        cout<<"ERROR!!! You cannot divide anything by 0\n\n";
        goto main;
    }
    ans2=v1 / v2;
    cout<<"Answer: "<<ans2<<"\n\n";
    cout<<"Would like to solve another one <yn>: ";
    cin>>yn;
    goto main;
    return 0;

subtraction:
    cout<<"\n\t\t==================Subtraction===============\n";
    cout<<"Enter your First Number: ";
    cin>>v1;
    cout<<"Enter your Second Number: ";
    cin>>v2;
    ans2=v1 - v2;
    cout<<"Answer: "<<ans2<<"\n\n";
    cout<<"Would like to solve another one <yn>: ";
    cin>>yn;
    goto main;
    return 0;
addition:
    cout<<"\n\t\t==================Addition===============\n";
    cout<<"Enter your First Number: ";
    cin>>v1;
    cout<<"Enter your Second Number: ";
    cin>>v2;
    ans2=v1 + v2;
    cout<<"Answer: "<<ans2<<"\n\n";
    cout<<"Would like to solve another one <yn>: ";
    cin>>yn;
    goto main;
    return 0;
power:
    cout<<"\n\t\t==================Power===============\n";
    cout<<"Enter a number: ";
    cin>>v1;
    cout<<"Enter the Power: ";
    cin>>v2;
    ans2=v1;
    for(int i=2; i<=v2; i++)
    ans2 = ans2 * v1;
    cout<<"Answer: "<<ans2<<"\n\n";
    cout<<"Would like to solve another one <yn>: ";
    cin>>yn;
    goto main;
    return 0;
}
return 0;
}

c++ Program to perform Magic Courtesy : ENRICO X

C++ Program to perform Magic Courtesy : ENRICO X THE MAGICIAN  :  Enrico  Lorenzo

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
main()
{
clrscr();
_setcursortype(_NOCURSOR);
int x, x2=6, lo, di;
int x3=5, x4=3, x5=4;
char cho, col, col2, col3;
randomize();
clrscr();
sleep(2);
textcolor(15);
gotoxy(44,13);cprintf("X");
delay(100);
textcolor(0);
gotoxy(44,13);cprintf(" ");
textcolor(15);
gotoxy(42,13);cprintf("O");
delay(100);
textcolor(0);
gotoxy(42,13);cprintf(" ");
textcolor(15);
gotoxy(41,13);cprintf("C");
delay(100);
textcolor(0);
gotoxy(41,13);cprintf(" ");
textcolor(15);
gotoxy(40,13);cprintf("I");
delay(100);
textcolor(0);
gotoxy(40,13);cprintf(" ");
textcolor(15);
gotoxy(39,13);cprintf("R");
delay(100);
textcolor(0);
gotoxy(39,13);cprintf(" ");
textcolor(15);
gotoxy(38,13);cprintf("N");
delay(100);
textcolor(0);
gotoxy(38,13);cprintf(" ");
textcolor(15);
gotoxy(37,13);cprintf("E");
delay(100);
textcolor(0);
gotoxy(37,13);cprintf(" ");
delay(100);
textcolor(15);
gotoxy(37,13);cprintf("E");
delay(100);
textcolor(8);
gotoxy(37,13);cprintf("E");
textcolor(15);
gotoxy(38,13);cprintf("N");
delay(100);
textcolor(8);
gotoxy(38,13);cprintf("N");
textcolor(15);
gotoxy(39,13);cprintf("R");
delay(100);
textcolor(8);
gotoxy(39,13);cprintf("R");
textcolor(15);
gotoxy(40,13);cprintf("I");
delay(100);
textcolor(8);
gotoxy(40,13);cprintf("I");
textcolor(15);
gotoxy(41,13);cprintf("C");
delay(100);
textcolor(8);
gotoxy(41,13);cprintf("C");
textcolor(15);
gotoxy(42,13);cprintf("O");
delay(100);
textcolor(8);
gotoxy(42,13);cprintf("O");
textcolor(15);
gotoxy(44,13);cprintf("X");
delay(100);
textcolor(8);
gotoxy(44,13);cprintf("X");
sleep(2);
clrscr();
textcolor(15);
gotoxy(35,13);cprintf("T");
delay(100);
gotoxy(36,13);cprintf("H");
textcolor(8);
gotoxy(35,13);cprintf("T");
delay(100);
gotoxy(36,13);cprintf("H");
textcolor(15);
gotoxy(37,13);cprintf("E");
delay(100);
gotoxy(39,13);cprintf("M");
textcolor(8);
gotoxy(37,13);cprintf("E");
delay(100);
gotoxy(39,13);cprintf("M");
textcolor(15);
gotoxy(40,13);cprintf("%c", x2);
delay(100);
gotoxy(41,13);cprintf("G");
textcolor(8);
gotoxy(40,13);cprintf("%c", x2);
delay(100);
gotoxy(41,13);cprintf("G");
textcolor(15);
gotoxy(42,13);cprintf("I");
delay(100);
gotoxy(43,13);cprintf("C");
textcolor(8);
gotoxy(42,13);cprintf("I");
delay(100);
gotoxy(43,13);cprintf("C");
textcolor(15);
gotoxy(44,13);cprintf("I");
delay(100);
gotoxy(45,13);cprintf("%c", x3);
textcolor(8);
gotoxy(44,13);cprintf("I");
delay(100);
gotoxy(45,13);cprintf("%c", x3);
textcolor(15);
gotoxy(46,13);cprintf("N");
delay(100);
textcolor(8);
gotoxy(46,13);cprintf("N");
delay(100);
gotoxy(35,13);cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
gotoxy(39,13);cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
sleep(2);
clrscr();
for(x=1; x<=50; x++)
  {
  textcolor(8);
  gotoxy(random(80), random(25));cprintf("%c", x2);
  delay(10);
  gotoxy(random(80), random(25));cprintf("%c", x3);
  delay(10);
  textcolor(4);
  gotoxy(random(80), random(25));cprintf("%c", x4);
  delay(10);
  gotoxy(random(80), random(25));cprintf("%c", x5);
  delay(10);
  }
intro:
clrscr();
textcolor(8);
gotoxy(1,1);cprintf(" nter");
gotoxy(73,25);cprintf(" redits");
gotoxy(68,1);cprintf("THE M%cGICI%cN", x2, x3);
gotoxy(1,25);cprintf("Best viewed in maximize window");
textcolor(15);
gotoxy(1,1);cprintf("E");
gotoxy(73,25);cprintf("C");
cho=getch();

if(cho=='e' || cho=='E')
{
clrscr();
for(lo=28; lo<=53; lo++)
  {
  textcolor(8);
  gotoxy(lo,14);cprintf("ÛÛ");
  }

for(lo=0, di=28; lo<=100; lo+=4, di++)
  {
  textcolor(15);
  gotoxy(28,12);cprintf("initializing trick...");
  gotoxy(28,13);cprintf("%d%", lo);
  gotoxy(di,14);cprintf("ÛÛ");
  delay(200);
  }
sleep(2);
refresh:
clrscr();
textcolor(8);
gotoxy(35,1);cprintf("THE M%cGICI%cN", x2, x3);
textcolor(15);
gotoxy(27,2);cprintf("ÚÄÄÄÄÄÄ¿");
gotoxy(27,3);cprintf("³      ³");
gotoxy(27,4);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,5);cprintf("³      ³");
gotoxy(27,6);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,7);cprintf("³      ³");
gotoxy(27,8);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,9);cprintf("³      ³");
gotoxy(27,10);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,11);cprintf("³      ³");
gotoxy(27,12);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,13);cprintf("³      ³");
gotoxy(27,14);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,15);cprintf("³      ³");
gotoxy(27,16);cprintf("³      ³");
gotoxy(27,17);cprintf("³      ³");
gotoxy(27,18);cprintf("ÀÄÄÄÄÄÄÙ");

gotoxy(37,2);cprintf("ÚÄÄÄÄÄÄ¿");
gotoxy(37,3);cprintf("³      ³");
gotoxy(37,4);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,5);cprintf("³      ³");
gotoxy(37,6);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,7);cprintf("³      ³");
gotoxy(37,8);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,9);cprintf("³      ³");
gotoxy(37,10);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,11);cprintf("³      ³");
gotoxy(37,12);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,13);cprintf("³      ³");
gotoxy(37,14);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,15);cprintf("³      ³");
gotoxy(37,16);cprintf("³      ³");
gotoxy(37,17);cprintf("³      ³");
gotoxy(37,18);cprintf("ÀÄÄÄÄÄÄÙ");

gotoxy(47,2);cprintf("ÚÄÄÄÄÄÄ¿");
gotoxy(47,3);cprintf("³      ³");
gotoxy(47,4);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,5);cprintf("³      ³");
gotoxy(47,6);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,7);cprintf("³      ³");
gotoxy(47,8);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,9);cprintf("³      ³");
gotoxy(47,10);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,11);cprintf("³      ³");
gotoxy(47,12);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,13);cprintf("³      ³");
gotoxy(47,14);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,15);cprintf("³      ³");
gotoxy(47,16);cprintf("³      ³");
gotoxy(47,17);cprintf("³      ³");
gotoxy(47,18);cprintf("ÀÄÄÄÄÄÄÙ");
textcolor(8);
gotoxy(1,25);cprintf(" efresh");
textcolor(15);
gotoxy(1,25);cprintf("R");
gotoxy(35,20);cprintf("Pick a card!");
gotoxy(32,21);cprintf("Enter which column!");
textcolor(7);
gotoxy(33,17);cprintf("1");
gotoxy(43,17);cprintf("2");
gotoxy(53,17);cprintf("3");

textcolor(4);
x=3;
gotoxy(28,3);cprintf("K%c", x);
gotoxy(28,7);cprintf("3%c", x);
gotoxy(28,9);cprintf("Q%c", x);
gotoxy(28,11);cprintf("6%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(28,15);cprintf("9%c", x);
textcolor(8);
x=5;
gotoxy(48,7);cprintf("A%c", x2);
gotoxy(28,5);cprintf("4%c", x2);
gotoxy(38,3);cprintf("2%c", x);
gotoxy(38,5);cprintf("J%c", x);
gotoxy(38,7);cprintf("K%c", x);
gotoxy(38,9);cprintf("8%c", x);
gotoxy(38,13);cprintf("3%c", x);
gotoxy(38,15);cprintf("5%c", x);

textcolor(4);
x=4;
gotoxy(38,11);cprintf("7%c", x);
gotoxy(48,3);cprintf("2%c", x);
gotoxy(48,5);cprintf("9%c", x);
gotoxy(48,9);cprintf("J%c", x);
gotoxy(48,11);cprintf("Q%c", x);
gotoxy(48,13);cprintf("5%c", x);
gotoxy(48,15);cprintf("6%c", x);
back:
col=getch();
if(col=='1')
  {
  textcolor(8);
  gotoxy(33,23);cprintf("shuffling cards...");
  sleep(2);
  textcolor(15);
  gotoxy(35,20);cprintf("Where is it?");
  gotoxy(33,23);cprintf("                  ");
  textcolor(4);
  x=4;
  gotoxy(28,15);cprintf("7%c", x);
  gotoxy(28,3);cprintf("2%c", x);
  gotoxy(38,3);cprintf("9%c", x);
  gotoxy(28,5);cprintf("J%c", x);
  gotoxy(38,5);cprintf("Q%c", x);
  gotoxy(48,5);cprintf("5%c", x);
  gotoxy(28,7);cprintf("6%c", x);

  textcolor(4);
  x=3;
  gotoxy(38,7);cprintf("K%c", x);
  gotoxy(28,9);cprintf("3%c", x);
  gotoxy(38,9);cprintf("Q%c", x);
  gotoxy(48,9);cprintf("6%c", x);
  gotoxy(28,11);cprintf("J%c", x);
  gotoxy(38,11);cprintf("9%c", x);

  textcolor(8);
  x=5;
  gotoxy(48,3);cprintf("A%c", x2);
  gotoxy(48,7);cprintf("4%c", x2);
  gotoxy(48,11);cprintf("2%c", x);
  gotoxy(28,13);cprintf("J%c", x);
  gotoxy(38,13);cprintf("K%c", x);
  gotoxy(48,13);cprintf("8%c", x);
  gotoxy(38,15);cprintf("3%c", x);
  gotoxy(48,15);cprintf("5%c", x);
  back2:
  col2=getch();

  if(col2=='1')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=4;
    gotoxy(38,11);cprintf("7%c", x);
    gotoxy(38,7);cprintf("2%c", x);
    gotoxy(48,11);cprintf("9%c", x);
    gotoxy(48,7);cprintf("J%c", x);
    gotoxy(28,13);cprintf("Q%c", x);
    gotoxy(38,3);cprintf("5%c", x);
    gotoxy(28,9);cprintf("6%c", x);

    textcolor(4);
    x=3;
    gotoxy(38,13);cprintf("K%c", x);
    gotoxy(38,9);cprintf("3%c", x);
    gotoxy(48,13);cprintf("Q%c", x);
    gotoxy(28,5);cprintf("6%c", x);
    gotoxy(48,9);cprintf("J%c", x);
    gotoxy(28,15);cprintf("9%c", x);

    textcolor(8);
    x=5;
    gotoxy(28,3);cprintf("A%c", x2);
    gotoxy(48,3);cprintf("4%c", x2);
    gotoxy(38,5);cprintf("2%c", x);
    gotoxy(28,11);cprintf("J%c", x);
    gotoxy(38,15);cprintf("K%c", x);
    gotoxy(48,5);cprintf("8%c", x);
    gotoxy(48,15);cprintf("3%c", x);
    gotoxy(28,7);cprintf("5%c", x);
    back3:
    col3=getch();

    if(col3=='2')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("3%c", x);
      }
    else if(col3=='3')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("J%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else
      goto back3;
    }
  else if(col2=='2')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=4;
    gotoxy(48,15);cprintf("7%c", x);
    gotoxy(48,11);cprintf("2%c", x);
    gotoxy(38,7);cprintf("9%c", x);
    gotoxy(28,13);cprintf("J%c", x);
    gotoxy(48,7);cprintf("Q%c", x);
    gotoxy(38,3);cprintf("5%c", x);
    gotoxy(38,13);cprintf("6%c", x);

    textcolor(4);
    x=3;
    gotoxy(28,9);cprintf("K%c", x);
    gotoxy(48,13);cprintf("3%c", x);
    gotoxy(38,9);cprintf("Q%c", x);
    gotoxy(28,5);cprintf("6%c", x);
    gotoxy(28,15);cprintf("J%c", x);
    gotoxy(48,9);cprintf("9%c", x);

    textcolor(8);
    x=5;
    gotoxy(28,3);cprintf("A%c", x2);
    gotoxy(48,3);cprintf("4%c", x2);
    gotoxy(38,5);cprintf("2%c", x);
    gotoxy(38,15);cprintf("J%c", x);
    gotoxy(28,11);cprintf("K%c", x);
    gotoxy(48,5);cprintf("8%c", x);
    gotoxy(38,11);cprintf("3%c", x);
    gotoxy(28,7);cprintf("5%c", x);
    back4:
    col3=getch();

    if(col3=='1')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("K%c", x);
      }
    else if(col3=='2')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("Q%c", x);
      }
    else if(col3=='3')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("9%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else
      goto back4;
    }
  else if(col2=='3')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=4;
    gotoxy(48,15);cprintf("7%c", x);
    gotoxy(48,11);cprintf("2%c", x);
    gotoxy(28,3);cprintf("9%c", x);
    gotoxy(28,13);cprintf("J%c", x);
    gotoxy(38,3);cprintf("Q%c", x);
    gotoxy(48,7);cprintf("5%c", x);
    gotoxy(38,13);cprintf("6%c", x);

    textcolor(4);
    x=3;
    gotoxy(48,3);cprintf("K%c", x);
    gotoxy(48,13);cprintf("3%c", x);
    gotoxy(28,5);cprintf("Q%c", x);
    gotoxy(38,9);cprintf("6%c", x);
    gotoxy(28,15);cprintf("J%c", x);
    gotoxy(38,5);cprintf("9%c", x);

    textcolor(8);
    x=5;
    gotoxy(38,7);cprintf("A%c", x2);
    gotoxy(28,9);cprintf("4%c", x2);
    gotoxy(48,9);cprintf("2%c", x);
    gotoxy(38,15);cprintf("J%c", x);
    gotoxy(48,5);cprintf("K%c", x);
    gotoxy(28,11);cprintf("8%c", x);
    gotoxy(28,7);cprintf("3%c", x);
    gotoxy(38,11);cprintf("5%c", x);
    back5:
    col3=getch();

    if(col3=='1')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(8);
      gotoxy(46,13);cprintf("4%c", x2);
      }
    else if(col3=='2')
      {
      clrscr();
      x=3;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("6%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else
      goto back5;
    }
  else if(col2=='r' || col2=='R')
    goto refresh;
  else
    goto back2;
  }
else if(col=='2')
  {
  textcolor(8);
  gotoxy(33,23);cprintf("shuffling cards...");
  sleep(2);
  textcolor(15);
  gotoxy(35,20);cprintf("Where is it?");
  gotoxy(33,23);cprintf("                  ");
  textcolor(4);
  x=4;
  gotoxy(48,9);cprintf("7%c", x);
  gotoxy(28,3);cprintf("2%c", x);
  gotoxy(38,3);cprintf("9%c", x);
  gotoxy(28,5);cprintf("J%c", x);
  gotoxy(38,5);cprintf("Q%c", x);
  gotoxy(48,5);cprintf("5%c", x);
  gotoxy(28,7);cprintf("6%c", x);

  textcolor(8);
  x=5;
  gotoxy(48,3);cprintf("A%c", x2);
  gotoxy(28,13);cprintf("4%c", x2);
  gotoxy(38,7);cprintf("2%c", x);
  gotoxy(48,7);cprintf("J%c", x);
  gotoxy(28,9);cprintf("K%c", x);
  gotoxy(38,9);cprintf("8%c", x);
  gotoxy(28,11);cprintf("3%c", x);
  gotoxy(38,11);cprintf("5%c", x);

  textcolor(4);
  x=3;
  gotoxy(48,11);cprintf("K%c", x);
  gotoxy(38,13);cprintf("3%c", x);
  gotoxy(48,13);cprintf("Q%c", x);
  gotoxy(28,15);cprintf("6%c", x);
  gotoxy(38,15);cprintf("J%c", x);
  gotoxy(48,15);cprintf("9%c", x);
  back6:
  col2=getch();

  if(col2=='1')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=4;
    gotoxy(28,5);cprintf("7%c", x);
    gotoxy(38,7);cprintf("2%c", x);
    gotoxy(48,11);cprintf("9%c", x);
    gotoxy(48,7);cprintf("J%c", x);
    gotoxy(28,13);cprintf("Q%c", x);
    gotoxy(38,3);cprintf("5%c", x);
    gotoxy(28,9);cprintf("6%c", x);

    textcolor(8);
    x=5;
    gotoxy(28,3);cprintf("A%c", x2);
    gotoxy(28,11);cprintf("4%c", x2);
    gotoxy(38,13);cprintf("2%c", x);
    gotoxy(48,3);cprintf("J%c", x);
    gotoxy(38,9);cprintf("K%c", x);
    gotoxy(48,13);cprintf("8%c", x);
    gotoxy(48,9);cprintf("3%c", x);
    gotoxy(28,15);cprintf("5%c", x);

    textcolor(4);
    x=3;
    gotoxy(38,5);cprintf("K%c", x);
    gotoxy(38,15);cprintf("3%c", x);
    gotoxy(48,5);cprintf("Q%c", x);
    gotoxy(38,11);cprintf("6%c", x);
    gotoxy(48,15);cprintf("J%c", x);
    gotoxy(28,7);cprintf("9%c", x);
    back7:
    col3=getch();

    if(col3=='2')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(8);
      gotoxy(46,13);cprintf("K%c", x);
      }
    else if(col3=='3')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(8);
      gotoxy(46,13);cprintf("3%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else goto back7;
    }
  else if(col2=='2')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=4;
    gotoxy(28,5);cprintf("7%c", x);
    gotoxy(48,11);cprintf("2%c", x);
    gotoxy(38,7);cprintf("9%c", x);
    gotoxy(28,13);cprintf("J%c", x);
    gotoxy(48,7);cprintf("Q%c", x);
    gotoxy(38,3);cprintf("5%c", x);
    gotoxy(38,13);cprintf("6%c", x);

    textcolor(8);
    x=5;
    gotoxy(28,3);cprintf("A%c", x2);
    gotoxy(38,15);cprintf("4%c", x2);
    gotoxy(28,9);cprintf("2%c", x);
    gotoxy(48,3);cprintf("J%c", x);
    gotoxy(48,13);cprintf("K%c", x);
    gotoxy(38,9);cprintf("8%c", x);
    gotoxy(28,15);cprintf("3%c", x);
    gotoxy(48,9);cprintf("5%c", x);

    textcolor(4);
    x=3;
    gotoxy(38,5);cprintf("K%c", x);
    gotoxy(28,11);cprintf("3%c", x);
    gotoxy(48,5);cprintf("Q%c", x);
    gotoxy(48,15);cprintf("6%c", x);
    gotoxy(38,11);cprintf("J%c", x);
    gotoxy(28,7);cprintf("9%c", x);
    back8:
    col3=getch();

    if(col3=='1')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(8);
      gotoxy(46,13);cprintf("2%c", x);
      }
    else if(col3=='2')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is an");
      gotoxy(49,13);cprintf("!");
      textcolor(8);
      gotoxy(47,13);cprintf("8%c", x);
      }
    else if(col3=='3')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(8);
      gotoxy(46,13);cprintf("5%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else goto back8;
    }
  else if(col2=='3')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=4;
    gotoxy(38,9);cprintf("7%c", x);
    gotoxy(48,11);cprintf("2%c", x);
    gotoxy(28,3);cprintf("9%c", x);
    gotoxy(28,13);cprintf("J%c", x);
    gotoxy(38,3);cprintf("Q%c", x);
    gotoxy(48,7);cprintf("5%c", x);
    gotoxy(38,13);cprintf("6%c", x);

    textcolor(8);
    x=5;
    gotoxy(38,7);cprintf("A%c", x2);
    gotoxy(38,15);cprintf("4%c", x2);
    gotoxy(48,3);cprintf("2%c", x);
    gotoxy(28,9);cprintf("J%c", x);
    gotoxy(48,13);cprintf("K%c", x);
    gotoxy(28,5);cprintf("8%c", x);
    gotoxy(28,15);cprintf("3%c", x);
    gotoxy(38,5);cprintf("5%c", x);

    textcolor(4);
    x=3;
    gotoxy(48,9);cprintf("K%c", x);
    gotoxy(48,5);cprintf("3%c", x);
    gotoxy(28,11);cprintf("Q%c", x);
    gotoxy(48,15);cprintf("6%c", x);
    gotoxy(28,7);cprintf("J%c", x);
    gotoxy(38,11);cprintf("9%c", x);
    back9:
    col3=getch();

    if(col3=='1')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(8);
      gotoxy(46,13);cprintf("J%c", x);
      }
    else if(col3=='2')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("7%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else goto back9;
    }
  else if(col2=='r' || col2=='R')
    goto refresh;
  else goto back6;
  }
else if(col=='3')
  {
  textcolor(8);
  gotoxy(33,23);cprintf("shuffling cards...");
  sleep(2);
  textcolor(15);
  gotoxy(35,20);cprintf("Where is it?");
  gotoxy(33,23);cprintf("                  ");
  textcolor(4);
  x=3;
  gotoxy(28,3);cprintf("K%c", x);
  gotoxy(48,3);cprintf("3%c", x);
  gotoxy(28,5);cprintf("Q%c", x);
  gotoxy(38,5);cprintf("6%c", x);
  gotoxy(48,5);cprintf("J%c", x);
  gotoxy(28,7);cprintf("9%c", x);

  textcolor(4);
  x=4;
  gotoxy(28,15);cprintf("7%c", x);
  gotoxy(38,7);cprintf("2%c", x);
  gotoxy(48,7);cprintf("9%c", x);
  gotoxy(38,9);cprintf("J%c", x);
  gotoxy(48,9);cprintf("Q%c", x);
  gotoxy(28,11);cprintf("5%c", x);
  gotoxy(38,11);cprintf("6%c", x);

  textcolor(8);
  x=5;
  gotoxy(28,9);cprintf("A%c", x2);
  gotoxy(38,3);cprintf("4%c", x2);
  gotoxy(48,11);cprintf("2%c", x);
  gotoxy(28,13);cprintf("J%c", x);
  gotoxy(38,13);cprintf("K%c", x);
  gotoxy(48,13);cprintf("8%c", x);
  gotoxy(38,15);cprintf("3%c", x);
  gotoxy(48,15);cprintf("5%c", x);
  back10:
  col2=getch();

  if(col2=='1')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=3;
    gotoxy(38,7);cprintf("K%c", x);
    gotoxy(28,3);cprintf("3%c", x);
    gotoxy(48,7);cprintf("Q%c", x);
    gotoxy(28,13);cprintf("6%c", x);
    gotoxy(38,3);cprintf("J%c", x);
    gotoxy(28,9);cprintf("9%c", x);

    textcolor(4);
    x=4;
    gotoxy(38,11);cprintf("7%c", x);
    gotoxy(38,13);cprintf("2%c", x);
    gotoxy(48,3);cprintf("9%c", x);
    gotoxy(48,13);cprintf("J%c", x);
    gotoxy(28,5);cprintf("Q%c", x);
    gotoxy(48,9);cprintf("5%c", x);
    gotoxy(28,15);cprintf("6%c", x);

    textcolor(8);
    x=5;
    gotoxy(38,9);cprintf("A%c", x2);
    gotoxy(48,11);cprintf("4%c", x2);
    gotoxy(38,5);cprintf("2%c", x);
    gotoxy(28,11);cprintf("J%c", x);
    gotoxy(38,15);cprintf("K%c", x);
    gotoxy(48,5);cprintf("8%c", x);
    gotoxy(48,15);cprintf("3%c", x);
    gotoxy(28,7);cprintf("5%c", x);
    back11:
    col3=getch();

    if(col3=='2')
      {
      clrscr();
      x=5;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is an");
      gotoxy(49,13);cprintf("!");
      textcolor(8);
      gotoxy(47,13);cprintf("A%c", x2);
      }
    else if(col3=='3')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("5%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else goto back11;
    }
  else if(col2=='2')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=3;
    gotoxy(48,11);cprintf("K%c", x);
    gotoxy(28,3);cprintf("3%c", x);
    gotoxy(28,13);cprintf("Q%c", x);
    gotoxy(48,7);cprintf("6%c", x);
    gotoxy(38,3);cprintf("J%c", x);
    gotoxy(38,13);cprintf("9%c", x);

    textcolor(4);
    x=4;
    gotoxy(48,15);cprintf("7%c", x);
    gotoxy(28,9);cprintf("2%c", x);
    gotoxy(48,3);cprintf("9%c", x);
    gotoxy(38,9);cprintf("J%c", x);
    gotoxy(28,5);cprintf("Q%c", x);
    gotoxy(28,15);cprintf("5%c", x);
    gotoxy(48,9);cprintf("6%c", x);

    textcolor(8);
    x=5;
    gotoxy(48,13);cprintf("A%c", x2);
    gotoxy(38,7);cprintf("4%c", x2);
    gotoxy(38,5);cprintf("2%c", x);
    gotoxy(38,15);cprintf("J%c", x);
    gotoxy(28,11);cprintf("K%c", x);
    gotoxy(48,5);cprintf("8%c", x);
    gotoxy(38,11);cprintf("3%c", x);
    gotoxy(28,7);cprintf("5%c", x);
    back12:
    col3=getch();

    if(col3=='1')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("2%c", x);
      }
    else if(col3=='2')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("J%c", x);
      }
    else if(col3=='3')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("6%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else
      goto back12;
    }
  else if(col2=='3')
    {
    textcolor(8);
    gotoxy(33,23);cprintf("shuffling cards...");
    sleep(2);
    textcolor(15);
    gotoxy(35,20);cprintf("Where is it?");
    gotoxy(33,23);cprintf("                  ");
    textcolor(4);
    x=3;
    gotoxy(48,11);cprintf("K%c", x);
    gotoxy(38,7);cprintf("3%c", x);
    gotoxy(28,13);cprintf("Q%c", x);
    gotoxy(38,3);cprintf("6%c", x);
    gotoxy(48,7);cprintf("J%c", x);
    gotoxy(38,13);cprintf("9%c", x);

    textcolor(4);
    x=4;
    gotoxy(48,15);cprintf("7%c", x);
    gotoxy(48,3);cprintf("2%c", x);
    gotoxy(28,9);cprintf("9%c", x);
    gotoxy(28,5);cprintf("J%c", x);
    gotoxy(38,9);cprintf("Q%c", x);
    gotoxy(28,15);cprintf("5%c", x);
    gotoxy(38,5);cprintf("6%c", x);

    textcolor(8);
    x=5;
    gotoxy(48,13);cprintf("A%c", x2);
    gotoxy(28,3);cprintf("4%c", x2);
    gotoxy(48,9);cprintf("2%c", x);
    gotoxy(38,15);cprintf("J%c", x);
    gotoxy(48,5);cprintf("K%c", x);
    gotoxy(28,11);cprintf("8%c", x);
    gotoxy(28,7);cprintf("3%c", x);
    gotoxy(38,11);cprintf("5%c", x);
    back13:
    col3=getch();

    if(col3=='1')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("9%c", x);
      }
    else if(col3=='2')
      {
      clrscr();
      x=4;
      textcolor(15);
      gotoxy(31,13);cprintf("Your card is a");
      gotoxy(48,13);cprintf("!");
      textcolor(4);
      gotoxy(46,13);cprintf("Q%c", x);
      }
    else if(col3=='r' || col3=='R')
      goto refresh;
    else
      goto back13;
    }
  else if(col2=='r' || col2=='R')
    goto refresh;
  else
    goto back10;
  }
else if(col=='r' || col=='R')
  goto refresh;
else
  goto back;
sleep(2);
clrscr();
textcolor(4);
gotoxy(37,13);cprintf("THE END!");
}
else if(cho=='c' || cho=='C')
  {
  clrscr();
  textcolor(8);
  gotoxy(1,5);cprintf(" nspired by:  afael  artin's magic");
  gotoxy(1,25);cprintf(" ress any key to exit");
  textcolor(15);
  gotoxy(1,1);cprintf("P");
  gotoxy(13,1);cprintf("E");
  gotoxy(20,1);cprintf("L");
  gotoxy(1,3);cprintf("S");
  gotoxy(20,3);cprintf("J");
  gotoxy(25,3);cprintf("J");
  gotoxy(1,5);cprintf("I");
  gotoxy(14,5);cprintf("R");
  gotoxy(21,5);cprintf("M");
  gotoxy(1,25);cprintf("P");
  gotoxy(22,25);cprintf("...");
  getch();
  goto intro;
  }
else
  goto intro;
return 0;
} 

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More