Passing Values

Hi, does anyone know how i can pass the values that have been entered in the the arrayEntry() function back to main?

thanks,

royal1664

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
42
43
44
45
46
47
48
49
  #include <iostream>

using namespace std;

void description(void);
int arrayEntry();

int nArray[10];
int colArray = 0;

int main()
{
    description();
    arrayEntry();

    int aNumber;
    cout << "Now enter an array value to view" << endl;
    cin >> aNumber;

    cout << "Vaule is " << nArray[aNumber];






    return 0;
}

void description(void)
{
    cout << "This program allows the user to enter \n"
        << "numbers into an array" << endl;
}

int arrayEntry()
{
    for(int nVal; nVal >= 0; colArray++)
    {
    cout << "Enter number to go into col "
        << colArray << ": ";
    cin >> nVal;
    nArray[colArray] = nVal;
    }

    return

}
Never mind, just worked it out lol

it's return nArray[colArray];

cheers!
Topic archived. No new replies allowed.