#include<iostream.h> #include<conio.h> #include<graphics.h> #include<stdlib.h> #
ID: 3634520 • Letter: #
Question
#include<iostream.h>#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
int graphics(int,int);
int A,B,ctr=0,guess;
int gd,gm;
int box1[26]=
{41,51,47,43,56,39,152,39,160,43,166,
51,166,188,160,196,153,201,53,201,45,
196,41,188,41,51};
int box2[26]=
{226,53,230,44,238,39,338,39,
345,44,349,52,349,188,344,197,
337,201,239,201,230,197,226,189,
226,53};
int box3[26]=
{410,51,415,42,423,39,517,39,527,44,
530,51,530,188,527,195,521,201,
423,201,414,196,410,188,410,51};
int box4[26]=
{131,230,136,222,145,217,244,217,
252,222,257,229,257,365,252,372,
245,377,144,378,137,373,131,366,
131,230};
int box5[26]=
{313,231,318,223,325,218,425,218,
433,223,438,231,438,364,432,372,
425,377,325,377,318,372,313,364,
313,231};
int heart1[42]=
{104,99,110,90,119,83,131,81,141,86,
147,98,145,113,137,128,128,138,117,145,
105,154,91,147,81,140,71,129,63,116,
60,102,64,89,75,81,90,83,98,91,104,99};
int heart2[42]=
{288,93,294,84,303,77,315,75,325,80,
331,92,329,107,321,122,312,132,301,140,
289,148,275,141,265,134,255,123,247,110,
244,96,248,83,259,75,274,77,282,85,288,93};
int heart3[42]=
{472,91,478,82,487,75,499,73,509,78,
515,90,513,105,505,120,496,130,485,138,
473,146,458,139,449,132,439,121,431,108,
428,94,432,81,443,73,458,75,466,83,472,91};
int heart4[42]=
{194,284,200,275,209,268,221,266,231,271,
237,283,235,298,227,313,217,323,207,331,
195,339,181,332,171,325,161,314,153,301,
150,287,154,274,165,266,180,268,188,276,
194,284};
int heart5[42]=
{376,282,382,273,391,266,403,264,413,269,
419,281,417,296,409,311,400,321,389,329,
377,337,363,330,353,323,343,312,335,299,
332,285,336,272,347,264,362,266,370,274,
376,282};
int clover1[70]=
{102,86,91,88,85,94,84,102,86,109,90,114,
81,109,71,111,65,121,65,131,68,139,74,145,
83,145,91,140,97,133,97,140,96,150,91,159,
109,159,104,149,102,139,103,133,105,138,
109,145,119,148,128,145,134,136,136,125,
131,115,122,111,113,114,117,105,117,97,
112,88,102,86};
int clover2[70]=
{290,85,279,87,273,93,271,101,274,107,
278,113,268,108,258,110,253,120,253,129,
256,137,262,144,271,144,279,139,284,131,
284,138,282,149,279,157,297,157,291,148,
290,138,290,131,293,137,297,143,307,147,
316,144,321,135,323,123,319,114,310,110,
300,112,304,103,305,95,300,87,290,85};
int clover3[70]=
{477,87,466,89,459,95,459,103,461,109,
465,115,456,111,446,112,440,122,440,131,
443,139,449,146,458,146,466,141,472,133,
472,140,470,151,465,159,484,159,478,150,
477,140,477,133,480,139,484,146,494,149,
503,145,508,136,510,125,506,116,496,112,
487,115,491,105,492,97,487,89,477,87};
int clover4[70]=
{195,269,184,271,177,277,177,285,179,292,
183,297,174,293,163,294,158,304,158,314,
161,321,167,328,176,328,184,323,190,315,
190,321,188,333,183,341,202,341,196,332,
195,332,195,316,199,321,202,327,212,331,
222,327,226,318,227,307,224,297,214,294,
206,297,209,286,211,279,205,271,195,269};
int clover5[70]=
{378,266,366,268,361,274,360,282,362,288,
365,294,357,290,347,291,341,301,341,310,
344,318,350,325,359,325,367,320,373,312,
373,319,371,330,366,338,386,338,380,329,
378,319,379,312,381,318,385,325,395,328,
404,325,409,316,411,304,406,294,398,291,
388,294,392,284,393,276,388,268,378,266};
int diamond1[10]=
{102,71,75,120,102,168,131,120,102,71};
int diamond2[10]=
{290,71,263,120,290,168,319,120,290,71};
int diamond3[10]=
{471,71,443,120,471,168,500,120,471,71};
int diamond4[10]=
{193,248,166,298,193,346,222,298,193,248};
int diamond5[10]=
{376,248,347,298,376,346,404,298,376,248};
int spade1[56]=
{100,77,94,87,83,96,71,105,64,114,64,134,
70,147,84,153,94,147,99,140,99,148,97,155,
96,159,90,165,113,165,107,158,104,153,
104,148,104,140,109,147,116,153,130,149,
138,139,140,124,136,112,125,103,110,90,100,77};
int spade2[56]=
{288,76,281,87,271,97,259,106,252,114,
252,133,257,148,272,154,281,148,287,140,
287,149,285,154,283,159,277,165,301,166,
294,158,292,154,292,148,291,140,297,147,
305,153,317,151,325,139,328,124,323,112,
313,102,298,90,288,76};
int spade3[56]=
{473,75,465,85,456,95,444,103,437,113,
437,132,441,145,456,151,465,146,471,138,
471,146,469,153,467,156,462,164,484,164,
478,157,476,152,475,146,475,138,481,145,
489,151,500,147,509,137,511,122,507,110,
497,100,483,89,473,75};
int spade4[56]=
{192,253,185,263,175,274,163,282,157,291,
155,311,161,324,176,330,185,324,191,317,
191,325,189,331,187,336,182,342,204,342,
198,335,196,330,195,325,195,317,201,324,
208,330,221,326,229,316,231,301,227,289,
217,279,202,267,192,253};
int spade5[56]=
{376,255,369,266,359,275,347,284,340,293,
339,313,344,326,359,331,369,326,374,319,
374,327,372,333,370,338,365,345,388,345,
381,337,379,332,378,327,378,319,384,326,
391,331,404,329,412,318,414,303,410,290,
399,280,385,268,376,255};
int deck1,deck2;
main(){
random:
A=rand()%13+1;
graphics(A,ctr);
gotoxy(20,20);
cout<<"Do you want to change your card [Y/N] ?";
getch();
if(getch()=='Y' || 'y')
goto random;
else{
do{
clrscr();
B=rand()%13+1;
ctr++;
gotoxy(20,21);
cout<<"What is your bet? [1] High or [2] Low?";
cin>>guess;
if(guess==1 && A<B || guess==2 && A<B){
cout<<"You Lose! ";
cout<<"Game Over!!";
break;
}
else if(guess==1 && A>B || guess==2 && A<B){
graphics(B,ctr);
B=A;
}
else
cout<<"Invalid Choice!";
}while(ctr<5);
getch();
return 1;
}
int graphics(int A,int X)
{
gd=DETECT;
gm=0;
initgraph(&gd,&gm," ");
int X=ctr;
X++;
{
setbkcolor(BLACK);
if(X==1)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(7,4);
cout<<"A";
gotoxy(18,12);
cout<<"A";
break;
case 11: gotoxy(7,4);
cout<<"J";
gotoxy(18,12);
cout<<"J";
break;
case 12: gotoxy(7,4);
cout<<"Q";
gotoxy(18,12);
cout<<"Q";
break;
case 13: gotoxy(7,4);
cout<<"K";
gotoxy(18,12);
cout<<"K";
break;
default:gotoxy(7,4);
cout<<" "<<deck1;
gotoxy(18,12);
cout<<" "<<deck1;
}
switch(deck2)
{
case 1: drawpoly(13, box1);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart1);
break;
case 2: drawpoly(13, box1);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover1);
break;
case 3:drawpoly(13,box1);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond1);
break;
default:drawpoly(13,box1);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade1);
}
return X;
}
if(X==2)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(30,4);
cout<<"A";
gotoxy(40,12);
cout<<"A";
break;
case 11: gotoxy(30,4);
cout<<"J";
gotoxy(40,12);
cout<<"J";
break;
case 12: gotoxy(30,4);
cout<<"Q";
gotoxy(40,12);
cout<<"Q";
break;
case 13: gotoxy(30,4);
cout<<"K";
gotoxy(40,12);
cout<<"K";
break;
default:gotoxy(30,4);
cout<<" "<<deck1;
gotoxy(40,12);
cout<<" "<<deck1;
}
switch(deck2)
{
case 1: drawpoly(13, box2);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart2);
break;
case 2: drawpoly(13, box2);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover2);
break;
case 3:drawpoly(13, box2);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond2);
break;
default:drawpoly(13, box2);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade2);
}
return X;
}
if(X==3)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(53,4);
cout<<"A";
gotoxy(63,12);
cout<<"A";
break;
case 11: gotoxy(53,4);
cout<<"J";
gotoxy(63,12);
cout<<"J";
break;
case 12: gotoxy(53,4);
cout<<"Q";
gotoxy(63,12);
cout<<"Q";
break;
case 13: gotoxy(53,4);
cout<<"K";
gotoxy(63,12);
cout<<"K";
break;
default:gotoxy(53,4);
cout<<" "<<deck1;
gotoxy(63,12);
cout<<" "<<deck1;
}
switch(deck2)
{
case 1: drawpoly(13, box3);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart3);
break;
case 2: drawpoly(13, box3);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover3);
break;
case 3:drawpoly(13, box3);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond3);
break;
default:drawpoly(13, box3);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade3);
}
return X;
}
if(X==4)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(18,15);
cout<<"A";
gotoxy(29,23);
cout<<"A";
break;
case 11: gotoxy(18,15);
cout<<"J";
gotoxy(29,23);
cout<<"J";
break;
case 12: gotoxy(18,15);
cout<<"Q";
gotoxy(29,23);
cout<<"Q";
break;
case 13: gotoxy(18,15);
cout<<"K";
gotoxy(29,23);
cout<<"K";
break;
default:gotoxy(18,15);
cout<<" "<<deck1;
gotoxy(29,23);
cout<<" "<<deck1;
}
switch(deck2)
{
case 1: drawpoly(13, box4);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart4);
break;
case 2: drawpoly(13, box4);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover4);
break;
case 3:drawpoly(13, box4);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond4);
break;
default:drawpoly(13, box4);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade4);
}
return X;
}
if(X==5)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(41,15);
cout<<"A";
gotoxy(52,23);
cout<<"A";
break;
case 11: gotoxy(41,15);
cout<<"J";
gotoxy(52,23);
cout<<"J";
break;
case 12: gotoxy(41,15);
cout<<"Q";
gotoxy(52,53);
cout<<"Q";
break;
case 13: gotoxy(41,15);
cout<<"K";
gotoxy(52,23);
cout<<"K";
break;
default:gotoxy(41,15);
cout<<" "<<deck1;
gotoxy(52,23);
cout<<" "<<deck1;
}
switch(deck2)
{
case 1: drawpoly(13, box5);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart5);
break;
case 2: drawpoly(13, box5);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover5);
break;
case 3:drawpoly(13, box5);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond5);
break;
default:drawpoly(13, box5);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade5);
}
return X;
}
}}}
Explanation / Answer
Note: See your program is ok but
1-----the main() function is not terminated
2---- see the return type of graphics() is int ,but you are not storing any where the returned value while calling the graphics() function.
3------int gd = DETECT, gm; ----------is ok but you can not leave the field in initgraph() like
initgraph(&gd, &gm, "C:\TC\BGI");------set the path for BGI in your system
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
int graphics(int,int);
int A,B,ctr=0,guess;
int gd,gm;
int box1[26]=
{41,51,47,43,56,39,152,39,160,43,166,
51,166,188,160,196,153,201,53,201,45,
196,41,188,41,51};
int box2[26]=
{226,53,230,44,238,39,338,39,
345,44,349,52,349,188,344,197,
337,201,239,201,230,197,226,189,
226,53};
int box3[26]=
{410,51,415,42,423,39,517,39,527,44,
530,51,530,188,527,195,521,201,
423,201,414,196,410,188,410,51};
int box4[26]=
{131,230,136,222,145,217,244,217,
252,222,257,229,257,365,252,372,
245,377,144,378,137,373,131,366,
131,230};
int box5[26]=
{313,231,318,223,325,218,425,218,
433,223,438,231,438,364,432,372,
425,377,325,377,318,372,313,364,
313,231};
int heart1[42]=
{104,99,110,90,119,83,131,81,141,86,
147,98,145,113,137,128,128,138,117,145,
105,154,91,147,81,140,71,129,63,116,
60,102,64,89,75,81,90,83,98,91,104,99};
int heart2[42]=
{288,93,294,84,303,77,315,75,325,80,
331,92,329,107,321,122,312,132,301,140,
289,148,275,141,265,134,255,123,247,110,
244,96,248,83,259,75,274,77,282,85,288,93};
int heart3[42]=
{472,91,478,82,487,75,499,73,509,78,
515,90,513,105,505,120,496,130,485,138,
473,146,458,139,449,132,439,121,431,108,
428,94,432,81,443,73,458,75,466,83,472,91};
int heart4[42]=
{194,284,200,275,209,268,221,266,231,271,
237,283,235,298,227,313,217,323,207,331,
195,339,181,332,171,325,161,314,153,301,
150,287,154,274,165,266,180,268,188,276,
194,284};
int heart5[42]=
{376,282,382,273,391,266,403,264,413,269,
419,281,417,296,409,311,400,321,389,329,
377,337,363,330,353,323,343,312,335,299,
332,285,336,272,347,264,362,266,370,274,
376,282};
int clover1[70]=
{102,86,91,88,85,94,84,102,86,109,90,114,
81,109,71,111,65,121,65,131,68,139,74,145,
83,145,91,140,97,133,97,140,96,150,91,159,
109,159,104,149,102,139,103,133,105,138,
109,145,119,148,128,145,134,136,136,125,
131,115,122,111,113,114,117,105,117,97,
112,88,102,86};
int clover2[70]=
{290,85,279,87,273,93,271,101,274,107,
278,113,268,108,258,110,253,120,253,129,
256,137,262,144,271,144,279,139,284,131,
284,138,282,149,279,157,297,157,291,148,
290,138,290,131,293,137,297,143,307,147,
316,144,321,135,323,123,319,114,310,110,
300,112,304,103,305,95,300,87,290,85};
int clover3[70]=
{477,87,466,89,459,95,459,103,461,109,
465,115,456,111,446,112,440,122,440,131,
443,139,449,146,458,146,466,141,472,133,
472,140,470,151,465,159,484,159,478,150,
477,140,477,133,480,139,484,146,494,149,
503,145,508,136,510,125,506,116,496,112,
487,115,491,105,492,97,487,89,477,87};
int clover4[70]=
{195,269,184,271,177,277,177,285,179,292,
183,297,174,293,163,294,158,304,158,314,
161,321,167,328,176,328,184,323,190,315,
190,321,188,333,183,341,202,341,196,332,
195,332,195,316,199,321,202,327,212,331,
222,327,226,318,227,307,224,297,214,294,
206,297,209,286,211,279,205,271,195,269};
int clover5[70]=
{378,266,366,268,361,274,360,282,362,288,
365,294,357,290,347,291,341,301,341,310,
344,318,350,325,359,325,367,320,373,312,
373,319,371,330,366,338,386,338,380,329,
378,319,379,312,381,318,385,325,395,328,
404,325,409,316,411,304,406,294,398,291,
388,294,392,284,393,276,388,268,378,266};
int diamond1[10]=
{102,71,75,120,102,168,131,120,102,71};
int diamond2[10]=
{290,71,263,120,290,168,319,120,290,71};
int diamond3[10]=
{471,71,443,120,471,168,500,120,471,71};
int diamond4[10]=
{193,248,166,298,193,346,222,298,193,248};
int diamond5[10]=
{376,248,347,298,376,346,404,298,376,248};
int spade1[56]=
{100,77,94,87,83,96,71,105,64,114,64,134,
70,147,84,153,94,147,99,140,99,148,97,155,
96,159,90,165,113,165,107,158,104,153,
104,148,104,140,109,147,116,153,130,149,
138,139,140,124,136,112,125,103,110,90,100,77};
int spade2[56]=
{288,76,281,87,271,97,259,106,252,114,
252,133,257,148,272,154,281,148,287,140,
287,149,285,154,283,159,277,165,301,166,
294,158,292,154,292,148,291,140,297,147,
305,153,317,151,325,139,328,124,323,112,
313,102,298,90,288,76};
int spade3[56]=
{473,75,465,85,456,95,444,103,437,113,
437,132,441,145,456,151,465,146,471,138,
471,146,469,153,467,156,462,164,484,164,
478,157,476,152,475,146,475,138,481,145,
489,151,500,147,509,137,511,122,507,110,
497,100,483,89,473,75};
int spade4[56]=
{192,253,185,263,175,274,163,282,157,291,
155,311,161,324,176,330,185,324,191,317,
191,325,189,331,187,336,182,342,204,342,
198,335,196,330,195,325,195,317,201,324,
208,330,221,326,229,316,231,301,227,289,
217,279,202,267,192,253};
int spade5[56]=
{376,255,369,266,359,275,347,284,340,293,
339,313,344,326,359,331,369,326,374,319,
374,327,372,333,370,338,365,345,388,345,
381,337,379,332,378,327,378,319,384,326,
391,331,404,329,412,318,414,303,410,290,
399,280,385,268,376,255};
int deck1,deck2;
main()
{int i;
random:
A=rand()%13+1;
i=graphics(A,ctr);
gotoxy(20,20);
cout<<"Do you want to change your card [Y/N] ?";
getch();
if(getch()=='Y' || 'y')
goto random;
else{
do{
clrscr();
B=rand()%13+1;
ctr++;
gotoxy(20,21);
cout<<"What is your bet? [1] High or [2] Low?";
cin>>guess;
if(guess==1 && Acout<<"You Lose! ";
cout<<"Game Over!!";
break;
}
else if(guess==1 && A>B || guess==2 && Ai=graphics(B,ctr);
B=A;
}
else
cout<<"Invalid Choice!";
}while(ctr<5);
getch();
return 1;
}
}
int graphic(int A,int X)
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\tcgi");
X=ctr;
X++;
{
setbkcolor(BLACK);
if(X==1)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(7,4);
cout<<"A";
gotoxy(18,12);
cout<<"A";
break;
case 11: gotoxy(7,4);
cout<<"J";
gotoxy(18,12);
cout<<"J";
break;
case 12: gotoxy(7,4);
cout<<"Q";
gotoxy(18,12);
cout<<"Q";
break;
case 13: gotoxy(7,4);
cout<<"K";
gotoxy(18,12);
cout<<"K";
break;
default:gotoxy(7,4);
cout<<" "<gotoxy(18,12);
cout<<" "<}
switch(deck2)
{
case 1: drawpoly(13, box1);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart1);
break;
case 2: drawpoly(13, box1);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover1);
break;
case 3:drawpoly(13,box1);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond1);
break;
default:drawpoly(13,box1);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade1);
}
return X;
}
if(X==2)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(30,4);
cout<<"A";
gotoxy(40,12);
cout<<"A";
break;
case 11: gotoxy(30,4);
cout<<"J";
gotoxy(40,12);
cout<<"J";
break;
case 12: gotoxy(30,4);
cout<<"Q";
gotoxy(40,12);
cout<<"Q";
break;
case 13: gotoxy(30,4);
cout<<"K";
gotoxy(40,12);
cout<<"K";
break;
default:gotoxy(30,4);
cout<<" "<gotoxy(40,12);
cout<<" "<}
switch(deck2)
{
case 1: drawpoly(13, box2);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart2);
break;
case 2: drawpoly(13, box2);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover2);
break;
case 3:drawpoly(13, box2);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond2);
break;
default:drawpoly(13, box2);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade2);
}
return X;
}
if(X==3)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(53,4);
cout<<"A";
gotoxy(63,12);
cout<<"A";
break;
case 11: gotoxy(53,4);
cout<<"J";
gotoxy(63,12);
cout<<"J";
break;
case 12: gotoxy(53,4);
cout<<"Q";
gotoxy(63,12);
cout<<"Q";
break;
case 13: gotoxy(53,4);
cout<<"K";
gotoxy(63,12);
cout<<"K";
break;
default:gotoxy(53,4);
cout<<" "<gotoxy(63,12);
cout<<" "<}
switch(deck2)
{
case 1: drawpoly(13, box3);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart3);
break;
case 2: drawpoly(13, box3);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover3);
break;
case 3:drawpoly(13, box3);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond3);
break;
default:drawpoly(13, box3);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade3);
}
return X;
}
if(X==4)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(18,15);
cout<<"A";
gotoxy(29,23);
cout<<"A";
break;
case 11: gotoxy(18,15);
cout<<"J";
gotoxy(29,23);
cout<<"J";
break;
case 12: gotoxy(18,15);
cout<<"Q";
gotoxy(29,23);
cout<<"Q";
break;
case 13: gotoxy(18,15);
cout<<"K";
gotoxy(29,23);
cout<<"K";
break;
default:gotoxy(18,15);
cout<<" "<gotoxy(29,23);
cout<<" "<}
switch(deck2)
{
case 1: drawpoly(13, box4);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart4);
break;
case 2: drawpoly(13, box4);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover4);
break;
case 3:drawpoly(13, box4);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond4);
break;
default:drawpoly(13, box4);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade4);
}
return X;
}
if(X==5)
{
deck1=rand()%13+1;
deck2=rand()%4+1;
switch(deck1)
{
case 1: gotoxy(41,15);
cout<<"A";
gotoxy(52,23);
cout<<"A";
break;
case 11: gotoxy(41,15);
cout<<"J";
gotoxy(52,23);
cout<<"J";
break;
case 12: gotoxy(41,15);
cout<<"Q";
gotoxy(52,53);
cout<<"Q";
break;
case 13: gotoxy(41,15);
cout<<"K";
gotoxy(52,23);
cout<<"K";
break;
default:gotoxy(41,15);
cout<<" "<gotoxy(52,23);
cout<<" "<}
switch(deck2)
{
case 1: drawpoly(13, box5);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(21,heart5);
break;
case 2: drawpoly(13, box5);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(35,clover5);
break;
case 3:drawpoly(13, box5);
setfillstyle(1,RED);
setcolor(RED);
fillpoly(5,diamond5);
break;
default:drawpoly(13, box5);
setfillstyle(1,WHITE);
setcolor(WHITE);
fillpoly(28,spade5);
}
return X;
}}}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.