-->
当前位置:首页 > 题库

PROGRAMMING:Menu selection

Luz5年前 (2021-05-10)题库421
When there is a choice in life or program, we usually choose it through the menu. Here we choose one from many. Write a program to process the provided options and return the user's options.
###Input format:
Two lines of input, the first line is a number of options, the number is not more than 8, the separator may be a space or a comma, with a newline end. The second line is the user's choice, indicating which item is selected (from zero: 0-7).
###Output format:
The output is also two lines. The first line is a list of options arranged in sequence: No. 0, No. 1, No. 2... Each in a pair of []. The second line is the user's option: the option corresponding to the number entered by the user. If the user makes a wrong choice, the output will be: (null).
###Input sample 1:
```in
Basic, C C++,Java Python
one
```
###Output example: 1
```out
[0-Basic][1-C][2-C++][3-Java][4-Python]
C
```
###Input sample 2:
```in
Men and women
two
```
###Output example: 2
```out
[0-male] [1-female]
(null)
```






answer:If there is no answer, please comment