Add to Favorites    Make Home Page 3462 Online  
 Language Categories  
 Our Services  

Home » ASP Home » Language Home » card swapping game (Mini Project)

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title card swapping game (Mini Project)
Author nityanand
Author Email
Description
Category ASP » Language
Hits 375758
Code Select and Copy the 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(); }

Related Source Codes

Script Name Author
ııııııııııııııııııııı VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld
European Weeknumber menno

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptId=978


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review