Slot machine program in c

broken image
broken image
broken image

I just finished lesson 3 where it went over brief explanation of a function, how to call one, what it is to get you familiar with it but not to explain the whole 9 yards, which is in another lesson. After that happens once and get another set of 3 random numbers like '3 3 4', you get your 2 tokens and it doesn't take away the 3 like ti should work. }the bug is that when you execute the application and you type 'y' for your first set of random numbers and you get like '6 6 5' for example it will grant you your 2 tokens but then think that you lost and take away 3. That makes the code hard to reuse and impossible to unit-test. Lose(randomNumber, randomNumberTwo, randomNumberThree) Ĭout << 'Welcome to the most amazing text-based Slot Machine!' << endl Ĭout << 'Our fine Slot Machines are rigged so that you almost never win and so that we make BILLIONS of DOLLARS!' << endl Ĭout << 'Anyways, You have ' << tokens << 'tokens' << endl Ĭout << 'Soooo, have fun with these few tokens as you will have none left very, very, very SOON!' << endl įor(int playTime = 0 playTime<30001 playTime++) Your class has a public run() method everything else is a black box. WinTwoTokens(randomNumber, randomNumberTwo, randomNumberThree) WinThreeTokens(randomNumber, randomNumberTwo, randomNumberThree) If(firstNumber=secondNumber=thirdNumber)Ĭout << 'Your numbers are:\t' << randomNumber << '\t' << randomNumberTwo << '\t' << randomNumberThree Int winThreeTokens(int firstNumber, int secondNumber, int thirdNumber)

broken image