#include #include #include using namespace std; char suit(int); char picture(int); void swap(int&, int&); void swap(char&, char&); bool IsItFlush(char[][5], int); bool IsRoyalFlush(int[][5], int);...

C++, Virtual studios 2017. Please use the start up code to do the assignment. I have attached all needed files


#include #include #include using namespace std; char suit(int); char picture(int); void swap(int&, int&); void swap(char&, char&); bool IsItFlush(char[][5], int); bool IsRoyalFlush(int[][5], int); bool IsStraight(int[][5], int); int main() { int cards[5][5], Total[5] = {0}; char suits[5][5], tempsuit; int deck[52], picked[52] = {0}; int i,j,k, number, temp, start, index, minIndex, minValue; srand(time(NULL)); for (i = 0; i < 52;="" i++)="" {="" do="" {="" number="rand()" %="" 52;="" }="" while="" (picked[number]="" !="0);" deck[i]="number;" picked[number]++;="" }="" k="0;" for(i="0;" i="">< 5;="" i++)="" for="" (j="0;" j="">< 5;="" j++)="" {="" cards[i][j]="deck[k];" suits[i][j]="suit(deck[k]);" k++;="" }="" for="" (i="0;" i="">< 5;="" i++)="" {="" for="" (j="0;" j="">< 5;="" j++)="" {="" cout="">< setw(2)="">< cards[i][j]="">< suits[i][j]="">< '="" ';="" }="" cout="">< endl;="" }="" cout="">< endl="">< endl;="" for="" (i="0;" i="">< 5;="" i++)="" {="" for="" (j="0;" j="">< 5;="" j++)="" {="" cards[i][j]="cards[i][j]%13;" }="" cout="">< endl;="" }="" for="" (i="0;" i="">< 5;="" i++)="" {="" for="" (j="0;" j="">< 5;="" j++)="" {="" cout="">< setw(2)="">< cards[i][j]="">< suits[i][j]="">< '="" ';="" }="" cout="">< endl;="" }="" cout="">< endl="">< endl;="" for="" (i="0;" i="">< 5;="" i++)="" {="" for="" (j="0;" j="">< 5;="" j++)="" {="" temp="cards[i][j]" %="" 13;="" if="" (temp=""> 9 || temp == 0) cout < setw(3)="">< picture(temp);="" else="" cout="">< setw(3)="">< temp+1;="" cout="">< suits[i][j];="" k++;="" }="" cout="">< endl;="" }="" for="" (j="0;" j="">< 5;="" j++)="" {="" for="" (start="0;" start="">< 4;="" start++)="" {="" minindex="start;" minvalue="cards[j][start];" tempsuit="suits[j][start];" for="" (index="start" +="" 1;="" index="">< 5;="" index++)="" {="" if="" (cards[j][index]="">< minvalue)="" {="" minvalue="cards[j][index];" tempsuit="suits[j][index];" minindex="index;" }="" }="" swap(cards[j][minindex],="" cards[j][start]);="" swap(suits[j][minindex],="" suits[j][start]);="" }="" }="" cout="">< endl="">< endl;="" for="" (i="0;" i="">< 5;="" i++)="" {="" for="" (j="0;" j="">< 5;="" j++)="" {="" temp="cards[i][j]" %="" 13;="" if="" (temp=""> 9 || temp == 0) cout < setw(3)="">< picture(temp);="" else="" cout="">< setw(3)="">< temp="" +="" 1;="" cout="">< suits[i][j];="" k++;="" }="" cout="">< endl;="" }="" for="" (i="0;" i="">< 5; i++) // for all five players { // check if it is a flush if (isitflush(suits, i)) // 6,000,000 { // check if it is royal flush 10jqka - a10jqk if(isroyalflush(cards, i)) // 10,000,000 total[i] = 10,000,000; // check if it is a straight flush 5 cards one is higher than previous else if(isstraight(cards, i)) total[i] = 9000000 + cards[i][4] * 10000; else { total[i] = 6000000; if (cards[i][0] == 0) total[i] += 130, 000; else total[i] += cards[i][0]; total[i] += cards[i][4] * 10000; total[i] += cards[i][3] * 1000; total[i] += cards[i][2] * 100; total[i] += cards[i][1] * 10; } } // else if(check for 4 of a kind) 8,000,000 // else if( check for full house) 7,000,000 // else if 5;="" i++)="" for="" all="" five="" players="" {="" check="" if="" it="" is="" a="" flush="" if="" (isitflush(suits,="" i))="" 6,000,000="" {="" check="" if="" it="" is="" royal="" flush="" 10jqka="" -="" a10jqk="" if(isroyalflush(cards,="" i))="" 10,000,000="" total[i]="10,000,000;" check="" if="" it="" is="" a="" straight="" flush="" 5="" cards="" one="" is="" higher="" than="" previous="" else="" if(isstraight(cards,="" i))="" total[i]="9000000" +="" cards[i][4]="" *="" 10000;="" else="" {="" total[i]="6000000;" if="" (cards[i][0]="=" 0)="" total[i]="" +="130," 000;="" else="" total[i]="" +="cards[i][0];" total[i]="" +="cards[i][4]" *="" 10000;="" total[i]="" +="cards[i][3]" *="" 1000;="" total[i]="" +="cards[i][2]" *="" 100;="" total[i]="" +="cards[i][1]" *="" 10;="" }="" }="" else="" if(check="" for="" 4="" of="" a="" kind)="" 8,000,000="" else="" if(="" check="" for="" full="" house)="" 7,000,000="" else="">
Dec 13, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here