MORE ARRAYS!! need some help.

okay so i just came across another assignment and i have no clue how to store names in arrays or characters whatever. However this is what i have to do can anyone help me make sense of this?

==================================================================================
Write a three function program. The main function must create a string array with room for 10
elements. The main function should call the second function passing it the array as the first
argument and the size of the array as the second argument. The second function should get 8
names from the user and return the number of names to main. After the array is filled, main
should call a third function passing it the array as the first argument and the value returned by
function 2 as the second argument. The third function should display the names from the array on
separate lines on the computer screen. Name your program Lab10_Ex3.cpp.
Last edited on
What you do is throw your laptop across the room and give Mick like, I dont know 20 bucks.

But seriously can someone answer this? I need to know as well.
A typical array declaration: typename arrayname[sizeofarray];
For instance, an 8-element int array can be declared: int myIntArray[8];
Use this standard form of declaration, but apply it to a string and your desired size.

For tackling the multiple-function aspect, I recommend this reading:
http://www.cplusplus.com/doc/tutorial/functions2/
About four-fifths of the way down the page, there is a section entitled "Declaring Functions." That should provide sufficient information about your program's format.

Lastly, to prompt for the names and assign them to elements in the array, look into cout/cin functions (for both the second and third functions described in your assignment).
Topic archived. No new replies allowed.