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

PROGRAMMING:Array stew

Luz5年前 (2021-05-10)题库413
Define an integer array a, input the length n of the array through the keyboard, and assign the value to the array a through the keyboard. After the assignment, complete the following operations: < br / >
1. Output the elements of the whole array a at one time < br / >
2. Copy the data of array a to array B < br / >
3. Sort the array A and output the elements of the sorted array a at one time < br / >
4. Input a number through the keyboard to determine whether the number exists in the array. If there is a subscript where the number is output, there is no input no < br / >
5. From the element with subscript 0 to the element with subscript 2 (excluding 2) in array a, assign 9, and then output the value of the whole array at one time < br / >
6. Judge whether array A and array B are the same (the contents of array elements are the same). If they are the same, output yes, otherwise output No
###Input format:
The first line is the length of the input array a
On the second line, enter the elements of array a (separated by spaces)
On the third line, enter the element to query
###Output format:
For each group of inputs, output array a on the first line.
The second line outputs array B
The third line outputs the sorted array a
The fourth line outputs the query result
The fifth line outputs the array a filled with data
The sixth line outputs the result of two array judgments
###Input example:
Here is a set of inputs. For example:
```in
five
2 1 3 5 6
seven
```
```in
five
4 3 7 6 8
seven
```
###Output example:
The corresponding output is given here. For example:
```out
[2, 1, 3, 5, 6]
[2, 1, 3, 5, 6]
[1, 2, 3, 5, 6]
no
[9, 9, 3, 5, 6]
no
```
```out
[4, 3, 7, 6, 8]
[4, 3, 7, 6, 8]
[3, 4, 6, 7, 8]
three
[9, 9, 6, 7, 8]
no
```







answer:If there is no answer, please comment