I have a question on writing if-statements to determine if entered information is correct or not.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nick Haufler
am 27 Sep. 2015
Beantwortet: Star Strider
am 27 Sep. 2015
The problem is number 4 on the attached file. I am stuck on the last part where i have to write a conditional statement to determine if the selected bet is correct or not. Do i have to write an if statement for each scenario? I also attached my code, so you can see what im thinking. Im pretty close to having it all done, just not sure what the conditonal statement needs to include to determine if the bet was right or wrong. Thanks.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 27 Sep. 2015
First, the singular of ‘dice’ is ‘die’.
Second, in your if block, you do not compare your ‘choice’ variable with the outcome of the dice throws. That would seem to be important in determining who wins and how much.
An appropriate if construction might be something like:
if (choice == 1) & (Sum < 7)
... &c. ...
I leave the rest to you.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!