Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Just need a little help with this. I debugged it all the bugs

Just need a little help with this. I debugged it all the bugs seem to be out but when I run it I get odd wins

sometimes.  Cherry pays 1 if it pops up but I will get 1 win with 2 lemons and in the code I have where all 3 have to equal. ATTACHMENT PREVIEW Download attachment// Week 4 Assignment- 2// Description: Run-time errors in more loops and branching//———————————-//**begin #include fles************#include<iostream>// provides access to cin and cout#include<iomanip>#include<array>#include<vector>//–end oF #include fles———–//———————————-usingnamespacestd;//———————————-//**begin global constants**********// number oF positions on a reel (11)constintreelPositions = 11;//–end oF global constants———//———————————-//**begin main program**************intmain(){// seed random number generatorsrand(time(NULL));// create enum For symbolsenumsymbol{Lemon,Cherry,Orange,Bell,Bar,Jackpot};// create a struct For slot machine wheelstructWheel{array<string, reelPositions > symbols;array<symbol, reelPositions > eSymbols;intposition;stringselected;};//create an array oF three slot machine wheelsarray<Wheel, 3> slotMachine ={{{{“Bar”,”Orange”,”Lemon”,”Orange”,”Bell”,”Orange”,”Bar”,”Lemon”,”Bell”,”Jackpot”,”Bell”},{Bar,Orange,Lemon,Orange,Bell,Orange,Bar,Lemon,Bell,Jackpot,Bell},0,”Cherry”},{{“Lemon”,”Bell”,”Lemon”,”Orange”,”Bell”,”Jackpot”,”Bar”,”Lemon”,”Cherry”,”Jackpot”,”Bell”},{Lemon,Bell,Lemon,Orange,Bell,Jackpot,Bar,Lemon,Cherry,Jackpot,Bell},1,”Bell”},{

Background image of page 1

View the Answer{“Cherry”,”Orange”,”Bar”,”Lemon”,”Orange”,”Lemon”,”Orange”,”Lemon”,”Cherry”,”Jackpot”,”Bell”},{Cherry,Orange,Bar,Lemon,Orange,Lemon,Orange,Lemon,Cherry,Jackpot,Bell},2,”Lemon”}}};boolgameOn =true;intthePot = 100;intbet = 1;boolwinner =false;intwinnings = 0;charcheckKey =’\n’;vector<int> combo;cout<<“Hit return to bet, space and return to quit.”<<endl;while(gameOn){for(autos : slotMachine){s.position = (s.position + rand() % reelPositions) % reelPositions;s.selected=s.symbols[s.position];cout<<setw(10)<<left<<s.selected.c_str();combo.push_back(s.eSymbols[s.position]);}winnings = -bet;switch(combo[0]){caseLemon:switch(combo[1]){caseLemon:if((combo[0]==Lemon)&&(combo[1]==Lemon)&&(combo[2]==Lemon)) winnings = 1;elseif(combo[2]==Cherry) winnings = 1;break;caseCherry:winnings = 1;if(combo[2]==Cherry) winnings = rand() % 4 + 2;break;default:if(combo[2]==Cherry) winnings = 1;break;}break;caseCherry:winnings = 1;if((combo[1]==Cherry) && (combo[2]==Cherry)) winnings = 10;elseif((combo[1]==Cherry) || (combo[2]==Cherry)) winnings = rand()% 4 + 2;break;caseOrange:switch(combo[1]){caseOrange:

Background image of page 2

Show

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"