Lost universe of Programing

USERNAME :- Forum Post:-114
 
HomePortalGalleryRegisterLog in

Share | 
 

 card swapping game (Mini Project)

Go down 
AuthorMessage
Administrator
Admin
Admin
avatar

Male
Number of posts : 160
Age : 32
Location : Lucknow
Job/hobbies : Software Engeener
What U like To do ? : Because Its Rock with me.
Registration date : 2008-01-06

PostSubject: card swapping game (Mini Project)   3/13/2008, 8:28 pm

Code:
Code :
#include<graphics.h>
#include<dos.h>
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
const int clubs=0;
const int diamonds=1;
const int hearts=2;
const int spades=3;
const int jack=11;
const int queen=12;
const int king=13;
const int ace=14;
struct card
{
int number;
int suit;
};
void main()
{
clrscr();
card temp,chosen,prize;
char p,i=5,i1=3,i2=6,n;
int d,position,ch,x=100,x1=200,y=200,y1=350;
int gd=DETECT,gm;
initgraph(&gd,&gm,"") ;
card card1={7,clubs};
//setcolor(1);
//setbkcolor(4);
do
{
settextstyle(TRIPLEX_FONT,0,3);
outtextxy(100,50,"enter the level of the game?");
scanf("%d",&d);
cleardevice();
cout<<"
 
 
  "<<i<<"7";
outtextxy(200,300,"card1 is the 7 of clubs") ;
card card2={jack,hearts};
cout<<"  "<<i1<<"J";
outtextxy(200,350,"card2 is jack of hearts");
card card3={ace,spades};
cout<<"  "<<i2<<"A";
outtextxy(200,400,"card3 is ace of spades");
//setfillstyle(SOLID_FILL,14);
//setcolor(1) ;
//bar(100,100,200,250);
//gotoxy(400,200);
 
//bar(250,100,350,250);
//bar(400,100,500,250);
//rectangle(100,100,200,250);
//rectangle(250,100,350,250);
//rectangle(400,100,500,250);
 rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
prize=card3;
while((ch=getch())!='
')
{
switch(ch)
{
case'c':
//cout<<"
 i'am swaping card1 & card3
";
//outtextxy(300,300,"i'am swaping card1 & card3");
/*
temp=card3;
card3=card1;
card1=temp;
 for(x=110,x1=210,y=110,y1=260;x<400;x=x+10,x1=x1+10)
{
bar(x,y,x1,y1);
bar(100,100,200,250);
bar(250,100,350,250);
bar(400,100,500,250);
rectangle(x,y,x1,y1);
 rectangle(100,100,200,250);
rectangle(250,100,350,250);
rectangle(400,100,500,250);
 delay(d);
 cleardevice();
 }
//cleardevice();
bar(100,100,200,250);
bar(250,100,350,250);
bar(400,100,500,250);
rectangle(100,100,200,250);
rectangle(250,100,350,250);
rectangle(400,100,500,250);
*/
temp=card3;
card3=card1;
card1=temp;
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
for(x=110,x1=210,y=90,y1=190;x<=200;x=x+10,x1=x1+10,y=y-10,y1=y1-10)
{
rectangle(x,y,x1,y1);
delay(d);
cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
rectangle(x,y,x1,y1);
}
for(x=200,x1=300;x<=350;x=x+10,x1=x1+10)
{
rectangle(x,y,x1,y1);
delay(d) ;
cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
rectangle(x,y,x1,y1);
}
for(x=360,x1=470,y=0,y1=100;y<=100;x=x+10,y=y+10,x1=x1+10,y1=y1+10)
{
rectangle(x,y,x1,y1);
delay(d) ;
cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
rectangle(x,y,x1,y1);
}
for(x=450,x1=560,y=110,y1=210;x>=350;x=x-10,x1=x1-10,y=y+10,y1=y1+10)
{
rectangle(x,y,x1,y1);
delay(d);
cleardevice();
rectangle(100,100,200,200);
rectangle(270,100,370,200);
rectangle(460,100,570,200);
}
for(x=350,x1=460;x>=200;x=x-10,x1=x1-10)
{
rectangle(x,y,x1,y1);
delay(d) ;
cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
rectangle(x,y,x1,y1);
}
for(x=200,x1=310,y=210,y1=310;x>=100;x=x-10,x1=x1-10,y=y-10,y1=y1-10)
{
rectangle(x,y,x1,y1);
delay(d);
cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
}
break;
case'v':
//cout<<" i'am swaping card1 & card2
";
//outtextxy(300,300,"i'am swaping card1 & card2");
temp=card2;
card2=card3;
card1=temp;
for(x=110,x1=210,y=90,y1=190;x<270;x=x+10,x1=x1+10)
{rectangle(x,y,x1,y1);
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
 delay(d);
 cleardevice();
 }
 //cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
break;
case'b':
//cout<<" i'am swaping card2 & card3
";
//outtextxy(300,300,"i'am swaping card2 & card3");
temp=card3;
card3=card2;
card2=temp;
 for(x=280,x1=380,y=90,y1=190;x<450;x=x+10,x1=x1+10)
{
rectangle(x,y,x1,y1) ;
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
delay(d);
 cleardevice();
 }
//cleardevice();
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
break;
}
}
//cout<<" now where is the ace of spades?
";
settextstyle(TRIPLEX_FONT,0,2);
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
for(n=0;n<=3;n++)
{
outtextxy(100,350,"NOW WHERE IS THE ACE OF SPADES?");
delay(200);
cleardevice();
delay(200);

}
outtextxy(100,350,"NOW WHERE IS THE ACE OF SPADES?");
rectangle(100,100,200,200);
rectangle(460,100,570,200);
rectangle(270,100,370,200);
cin>>position;
switch(position)
{
case 1:chosen=card1;
break;
case 2:chosen=card2;
break;
case 3:chosen=card3;
break;
}
if(chosen.number==prize.number&&chosen.suit==prize.suit)
{
cleardevice();
settextstyle(TRIPLEX_FONT,0,3);
outtextxy(100,200,"THAT'S RIGHT YOU WIN
");
}
else
{
cleardevice();
settextstyle(TRIPLEX_FONT,0,3);
outtextxy(200,200,"SORRY YOU LOSE!
" );
outtextxy(200,300,"WANNA PLAY MORE?(Y/N).");
cin>>p;
}
}
while(p!='n');
getch();
}

_________________

""-(`v)-"HACKER OF HEART"-(`v)-"

Back to top Go down
View user profile http://aspx.forumotion.com
 
card swapping game (Mini Project)
Back to top 
Page 1 of 1
 Similar topics
-
» Unity3D Chess-
» Naruto-arena a online card game lol
» New Mini-Game: Bears Musical Chairs
» CHAOTIC GAME APP. (NEED EMPLOYEES)
» CHAOTIC GAME APP

Permissions in this forum:You cannot reply to topics in this forum
Lost universe of Programing :: --=| SOURCE CODE |=-- :: C/C++ SOURCE CODE-
Jump to: