A way to input a choice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A way to input a choice

To be concise, I was wondering if it is possible to be able to make the program able to give users a choice of what they want to do or see?

9th Nov 2020, 1:43 AM
Richard Goulbourne
5 Answers
+ 3
Yes, if you program it that way, but it will be limited to what you program it to do or have the capability of doing etc.
9th Nov 2020, 1:47 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
This would depend on the language, what it is you want to do, and how you wish to choose what to do. However, with most languages you will use some sort of decision tree (if, if-else, if-else if, switch, etc) with comparison statements to check against to run the code that is desired. If you'd like help with a small example, please specify the language, what should be compared (int, char, string, etc).
9th Nov 2020, 2:30 AM
ChaoticDawg
ChaoticDawg - avatar
9th Nov 2020, 3:30 AM
ChaoticDawg
ChaoticDawg - avatar
0
My question more specifically is how can i get it to work?
9th Nov 2020, 2:20 AM
Richard Goulbourne
0
How could I implement it in C++ exactly? My apologies for not clarifying earlier.
9th Nov 2020, 2:51 AM
Richard Goulbourne