--------------------
閱讀本主題的最佳解答--------------------
看到陣列兩個字我投就要昏了
根本不知道該如何下手..............
Write a menu-driven program that allows the user to fill an array of 50 integers with random numbers in the range of 0 to 1000. The program has the following functions:
(1) Fill the array with random numbers in the range of 0 to 1000. Each time this function is chosen the new random numbers is filled into the array.
(2) Print the array.
(3) Find the maximum and minimum value of the array.
(4) Calculate the mean deviation of the numbers in the array. The mean deviation is defined as Σ|x - x|/n where x = Σx/n.
Ex:
x1 = 124, x2 = 234, x3 = 562, x4 = 12 → x = (124 + 234 + 562 + 12)/4 = 233
mean deviation = (|124 - 233| + |234 - 233| + |562 - 233| + |12 - 233|)/4 = 165
(5) Count the value distributions.
A possible run may look like:
====================== Array Operation Menu ==================
1. Fill the array with random numbers in the range of 0 to 1000.
2. Print the array.
3. Find the maximum and minimum value of the array.
4. Calculate the mean deviation of the numbers in the array.
5. Count the value distributions for each consecutive 100 numbers.
6. Exit.
==========================================================
=> 1
50 random numbers in the range of 0 to 1000 has been filled into the array.
====================== Array Operation Menu ===================
1. Fill the array with random numbers in the range of 0 to 1000.
2. Print the array.
3. Find the maximum and minimum value of the array.
4. Calculate the mean deviation of the numbers in the array.
5. Count the value distributions for each consecutive 100 numbers.
6. Exit.
=========================================================
=> 2
The array is shown as follows:
578 984 630 927 146 917 369 922 598 550
101 51 481 230 901 82 669 759 395 639
42 930 34 576 374 448 359 659 692 705
521 978 303 938 877 18 24 530 487 302
416 186 496 71 667 386 542 877 338 615
====================== Array Operation Menu ===================
1. Fill the array with random numbers in the range of 0 to 1000.
2. Print the array.
3. Find the maximum and minimum value of the array.
4. Calculate the mean deviation of the numbers in the array.
5. Count the value distributions for each consecutive 100 numbers.
6. Exit.
=========================================================
=> 5
The value distributes are shown as follows:
Range Count
0 - 99 7
100 - 199 3
200 - 299 1
300 - 399 8
400 - 499 5
500 - 599 7
600 - 699 7
700 - 799 2
800 - 899 2
900 - 1000 8
====================== Array Operation Menu ==================
1. Fill the array with random numbers in the range of 0 to 1000.
2. Print the array.
3. Find the maximum and minimum value of the array.
4. Calculate the mean deviation of the numbers in the array.
5. Count the value distributions for each consecutive 100 numbers.
6. Exit.
==========================================================
=> 6
Bye!
有高手可以寫一下 借我參考嗎 感恩捏ˊˋ"