Redirecting the console output into an array?

Hi!
I have a problem with 2-d arrays, what i cant solve...I have to write a program, that settles if the most frequent birds peculiar to an area were the same. The number of areas is N. We note the number of the birds. The number of the species is M.
I have the maximum values, I can print them on the console, but I should redirect them into an array to make the end of the program. I tried the vector thingm but we haven't learned that and I can't cope with it. Does someone have a better idea? Here's the code, what i have.
(Sorry for my bad english.)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <iostream>
#include <windows.h>
#include <string>

using namespace std;

const int maxn=100;
const int maxm=100;

void input_size(int &n, int &m);
void input_names(string city[maxn], string species[maxm], int n, int m);
void input_array(int x[maxn][maxm], int n, int m, string city[maxn], string species[maxm]);
void max(const int x[maxn][maxm], int n, int m, string city[maxn], string species[maxm]);
void waitforkey();

int main()
{
    int x[maxn][maxm];
    int n, m;
    string city[maxn];
    string species[maxm];
    input_size(n, m);
    input_names(city, species, n, m);
    input_array(x, n, m, city, species);
    max(x, n, m, city, species);
    waitforkey();
}
void input_size(int &n, int &m)
    {
        string tmp;
        bool error;
        do
            {
            cout << "Number of cites? [0.." << maxn <<"] "; cin >> n;
            error=cin.fail() || n<=0 || n>maxn;
            if (error)
                {
                cout << "Error." << endl;
                cin.clear(); getline(cin,tmp,'\n');
                }
            }
        while (error);
        do
            {
            cout << "Number of birdspecies: [0.." << maxm <<"] "; cin >> m;
            error=cin.fail() || m<=0 || m>maxm;
            if (error)
                {
                cout << "Error." << endl;
                cin.clear(); getline(cin,tmp,'\n');
                }
            }
        while (error);
        cout << endl;
    }
void input_names(string city[maxn], string species[maxm], int n, int m)
    {
        string tmp;
        bool error;
        do
            {
            cout << "Enter the name of the cityes! (one name in one row)" << endl;
            for (int i=0; i<n; ++i)
            {
                cin >> city[i];
            }
            error=cin.fail();
            if (error)
                {
                cout << "Error." << endl;
                cin.clear(); getline(cin,tmp,'\n');
                }
            }
        while (error);
        cout << endl;
        do
            {
            cout << "Please enter the name of the species! (one name in one row)" << endl;
            for (int i=0; i<m; ++i)
                {
                cin >> species[i];
                }
            error=cin.fail();
            if (error)
                {
                cout << "Error." << endl;
                cin.clear(); getline(cin,tmp,'\n');
                }
            }
        while (error);
        cout << endl;
    }
void input_array(int x[maxn][maxm], int n, int m, string city[maxn], string species[maxm])
    {
    string tmp;
    bool error;
        cout << "Number of inspected birds: " << endl;
        for(int i = 0;i < n;++i)
            {
            cout << city[i] <<endl;
            for(int j = 0;j < m;++j)
                {
                    do
                    {
                        cout << species[j] << ": ";
                        cin >> x[i][j];
                        error=cin.fail();
                        if (error)
                            {
                            cout << "Error." << endl;
                            cin.clear(); getline(cin,tmp,'\n');
                            }
                        }
                      while (error);
                    }
                    cout << endl;
            }
            cout << "--------------------------------------------------" << endl;
    }
void max(const int x[maxn][maxm], int n, int m, string city[maxn], string species[maxm])
    {
        int bird, maxim;
        cout<< "Maximums: "<<endl;
        for (int i=0; i<n; ++i)
            {
                maxim=x[i][0];
                bird=0;
                for (int j=0; j<m; ++j)
                    {
                        if (x[i][j]>maxim)
                            {
                                maxim=x[i][j];
                                bird=j;
                            }
                    }
                cout << species[bird] << " (" << maxim << " " << city[i] << ")"<< endl;
            }
            cout << endl;
    }
void waitforkey()
    {
      system("pause");
    }
Topic archived. No new replies allowed.