Computer Programming Problem

Hello experienced programmers... I am currently a freshman EE major and I am required to take one course of computer programming for my major... I have an interesting problem, I don't understand a darn thing in my C++ class...

I have 6 homework problems and any help would be greatly appreciated...

1. Write a program to input a series of 12 integers from the keyboard and store them in a one-dimensional array, x[12], then displayed them on the computer screen in reverse order.

2. Write a program to generate a series of 1000 random numbers and store them in a one-dimensional array, a[1000], then determine and store those numbers that are evenly divisible by 20 in another one-dimensional integer array, b[200]. Also, display those numbers on the computer screen.

3. Write a program to generate a series of 20 random numbers and store them in a one-dimensional array, x[20], then determine and display the minimum and maximum numbers.

4. Write a program to generate a series of 30 random numbers and store them in a one-dimensional array, x[3], then determine and display the minimum and maximum numbers.

5. Four experiments are performed and each experiment produces four test results. The results are tabulated as shown below. Write a program to store these results in a two-dimensional array, A[4][5], then use a nested for-loop to compute the average of the test results for each experiment and store it in the 5th column of the array. Print the array.
1st experiment results: | 23.2 | 34.8 | 53.7 | 19.5 |
2nd experiment results: | 34.8 | 42.9 | 28.6 | 35.4 |
3rd experiment results: | 24.5 | 29.5 | 32.0 | 19.3 |
4th experiment results: | 36.8 | 31.6 | 43.7 | 29.5 |

6. Using the srand( ) and rand ( ) C++ library functions, fill an array of 1000 numbers with random numbers that have been scaled to the range of 1 to 100 inclusive. Then determine and display the number of random numbers having bvalues between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?

What methods should I approach each problem with? I know how to simply begin each program, but effectively writing/typing one is beyond my level of understanding... Thanks for your time.
All of these problems seem to revolve around filling an array. Do you know how to create/use arrays?

Larger problems can seem overwhelming, but really they are just a series of smaller problems. To learn to program, you need to learn how to break these problems down into smaller parts.

For example, take a look at #1:

1. Write a program to input a series of 12 integers from the keyboard and store them in a one-dimensional array, x[12], then displayed them on the computer screen in reverse order.


Think about the steps involved in making this program.

1) Create an array
2) Get an interger from the user, put it in the array
3) repeat #2 until you fill up the array (hint: for loop)
4) print the array in reverse order

The other problems can be approached the same way. Just break them down and take them one step at a time.
How do I create an array??? Our teacher has a foreign accent and is very difficult to understand; we as a class have a more than difficult time comprehending the daily lessons...
Check out the tutorials on this site for basics such as arrays.
http://cplusplus.com/doc/tutorial/arrays/
Thank You Disch!!!
Last edited on
Topic archived. No new replies allowed.