printing a user input in a array of char

I am using windows vista for my C++ program and a beginner so please keep it simple.

Lets say i have two functions, and one functions which is void contains a array of char [5][5] for example '-' and the second functions is to prompt the user to input anything he want input. How do i call the userinput function and put it into the array of char function? Keep it simple please, thanks in advance.
If your doing C++ (and not C) and your a beginner. Avoid using arrays and use strings.

http://www.cppreference.com/wiki/string/
I have something like this. It's not perfect but might help you in what you are trying to do...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>

using namespace std;


int main()
{
	char ArrayOne[26];  // declare a 1-D array
	char Array2D[5][5]; // declare  the 2-D array

	cout << "Input the characters" << endl; 
	cin >> ArrayOne; // take input
	
	int i, j, index = 0;
	

	// Assign each value from the single array 
	// to the 2D array
	for (i=0; i<5; ++i)
	{
		for (j=0; j<5; ++j)
		{
			Array2D[i][j] = ArrayOne[index];
			++index;
		}
	}
	
	
	// This part only outputs contents of the 2D array
	// to see if the above worked
	int row, col;
	for (row=0; row<5; ++row)
	{
		for (col=0; col<5; ++col)
		{
			cout << "Char[" << row << "][" << col << "]" << Array2D[row][col] << endl;
		}
	}
	
	return (0);
}



The program,
1. takes input from the user and stores it in a 1-dimensional array
2. takes each value from this array and puts in a 2-D array
Alrighty, Got it. Thanks.
Topic archived. No new replies allowed.