0

Int to string

1 = freshman 2 = sophomore 3 = junior 4 = senior 5 = senior I need an int input and print it to word Example Input =1 (must be int) Print= freshman

18th Jan 2019, 11:26 AM
Jefferson Villanueva
Jefferson Villanueva - avatar
8 Respostas
+ 2
Yes that sounds the right way, as long as you remember to add break at end of each case😉
21st Jan 2019, 12:50 AM
Gordon
Gordon - avatar
+ 3
switch-case https://www.sololearn.com/learn/CPlusPlus/1618/ Try it, if you still can't work out your homework, come back with a code attempt
18th Jan 2019, 11:35 AM
Gordon
Gordon - avatar
+ 1
If you like, I can give you an assignment to enhance your understanding.
21st Jan 2019, 4:04 AM
Gordon
Gordon - avatar
0
thanks. what I did is i put some cout inside the case using the switch statement.
21st Jan 2019, 12:12 AM
Jefferson Villanueva
Jefferson Villanueva - avatar
0
Gordon you want to check my activity for this question?
21st Jan 2019, 4:09 AM
Jefferson Villanueva
Jefferson Villanueva - avatar
0
No need I think you already achieved the problem in your question, isn't it? If you get the right result, then the code works and it is good. No need to inspect it. I am trying to guide you to progress in coding skill. If you don't mind, try this slightly different one: For Mark above or equal 95, output "Distinction!" For Mark between 40 and 94, output "Passed" For Mark below or equal 39, output "Failed" Code two versions, first one is using if else statements Second version is using switch. How to use switch-case statement to handle a range is a threshold to many programmer. You need to have a programmer's mindset in solving this problem.
21st Jan 2019, 4:16 AM
Gordon
Gordon - avatar
0
Gordon happy to do this activity. I’ll get back to you once I’m done.
21st Jan 2019, 4:19 AM
Jefferson Villanueva
Jefferson Villanueva - avatar
0
hi Gordon It’s been a while. using if else statement. https://code.sololearn.com/co4V1qggPNE1/?ref=app
10th Feb 2019, 5:53 PM
Jefferson Villanueva
Jefferson Villanueva - avatar