If statement matching numbers

5 vues (au cours des 30 derniers jours)
Mehmet Saglam
Mehmet Saglam le 22 Avr 2019
Commenté : Mehmet Saglam le 22 Avr 2019
Just need some insight on how to structure the code for this problem Im having. The code i have done so far is a lotto simulator, where the program will ask the use for its lotto numbers and through a if statment sees if they have won the lotto or not. I want to add addtional feature where lets say the user has got 3 numbers matched they will only get £1000. Is there a way to structure that code by any chance?

Réponse acceptée

Walter Roberson
Walter Roberson le 22 Avr 2019
sum(ismember(user_numbers, lotto_numbers)) gives the number of matches.
Around here, matching 3 only gets you a free ticket, not even your money back..
  1 commentaire
Mehmet Saglam
Mehmet Saglam le 22 Avr 2019
Walter you are a gentleman and a hero thank you soo much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by