• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# cw11

walkingthicc Feb 27th, 2020 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. clc
2. clear
3. %% prob1
4. age = input('how old you?');
5. if age > 0 & age < 11
6.     fprintf('You are %.0f years old? That means you are a child \n',age)
7. elseif age > 12 & age < 19
8.     fprintf('You are %.0f years old? That means you are a teen \n',age)
9. elseif age > 20 & age < 65
10.     fprintf('You are %.0f years old? That means you are an adult \n',age)
11. else age > 66
12.     fprintf('You are %.0f years old? That means you are an old geezer \n',age)
13. end
14. fprintf('\n')
15. clear
16. %% prob2
17. a = input('Would you like to begin your adventure? Y/N ', 's');
18. while (a == 'Y' ) | (a == 'y')
19.     x = randi([1 4],[1,1]);
20.
21.     Q = {'take the L, simp','you a dead guy','james got too close to CAS and pulled yo ass','WASTED'};
22.
23.     disp(Q(x))
24. a = input('Would you like to start again? Y/N ', 's');
25. end
26.
27. %% prob3
28. a = input('Would you like to roll? Y/N ', 's');
29. fprintf('\n')
30. while (a == 'Y' ) | (a == 'y')
31.     d = randi([1,6],[1,2]);
32.     fprintf('time stands still as you stare daggers at house and house stares back.\n the sweat glistens on Houses brow.\n your hands begin to rattle the die betwixt your figers.\n suddenly, both dice come tumbling onto the board!\n')
33.     fprintf('\n')
34.     if d(1) > d(2)
35.         fprintf('House rolled a %.0f and won :(',d(2))
36.     elseif d(1) == d(2)
37.         fprintf('\n')
38.         disp('Victory hangs in the balance of randi')
39.     else
40.         fprintf('You remain triumphant...')
41.     end
42. a = input('Would you like to roll again? Y/N' , 's');
43.
44. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top