If statement matching numbers

조회 수: 4 (최근 30일)
Mehmet Saglam
Mehmet Saglam 2019년 4월 22일
댓글: Mehmet Saglam 2019년 4월 22일
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?

채택된 답변

Walter Roberson
Walter Roberson 2019년 4월 22일
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
Mehmet Saglam
Mehmet Saglam 2019년 4월 22일
Walter you are a gentleman and a hero thank you soo much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by