### Need help with simple program!

I can't understand my computer science teacher and I need help writing these programs!

1. Write a program that reads 5 numbers from a user into a one-dimensional array and outputs them to the screen in both forward and backward order. This program should allow the user to enter as many sets of 5 numbers as they would like.

2. Write a program that always takes the numbers 1-20 and stores them into a one-dimensional array. The program should then take each number in the array and based on if that number is even or odd, place it in the first free space in one of two other one-dimensional arrays called Even and Odd. The the program should output the two arrays (Even/Odd) under an aptly named column heading.

I desperately need the var sections and main sections of these codes! Help on either problem would be highly appreciated!

I use Microsoft Visual Studio 2010 if that helps to narrow down any kind of unnecessary syntax that is incompatible with that software.
Last edited on
So, uh, you want us to do the programs for you, am I right?
Pretty much.
closed account (zb0S216C)
ProgramminNewby wrote:
can't understand my computer science teacher and I need help writing these programs! (sic)

For No. 1, look into arrays, loops, and I/O. I'll provide some links.

I'll get you started with some easy-to-read code:
 ``123456789101112131415161718`` ``````int main() { Declare an array of [5] integers = {set them to zero}; while(the user has the console open) { for(Loop until 5 integers have been extracted from the input buffer) Place the extracted integer into the next available space in the array; for(Loop until 5 cycles have passed) Start at the back of the array and print each integer accordingly; for(Loop until 5 cycles have passed) Start at the front of the array and print each integer accordingly; } Return from main(); }``````

References:

Arrays: http://www.cplusplus.com/doc/tutorial/arrays/
I/O: http://www.cplusplus.com/doc/tutorial/basic_io/
Loops: http://www.cplusplus.com/doc/tutorial/control/