Need help with this array code.

so i need to be able to have the user tell me a file to open, in that opened file, i need to write out the array that was filled with random integers. when i compile it i get loads of errors, help me ;/


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
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<ctime>
using namespace std;
 
int RowTest();
 
int ColumnTest();
 
int ArrayFiller();
 
int GetFileName();
 
int main()
{
    int Row = RowTest();
     
    int Column = ColumnTest();
     
    int Array [50][50] ;
     
    char FileName;
     
    srand ((time(NULL)));
     
    ofstream FileName;
     
    FileName.open ( " The file you are opening is " << FileName << \n; )
     
    FileName << ( ArrayFiller() );
     
    FileName.close();
     
    return(0);
     
}
 
int RowTest()
{
    int Row;
     
    cout << " Please enter a value for the row of the array that is between 2 and 50. \n";
     
    cin >> Row;
     
    if (1 >= Row || Row >= 51)
    {
        cout << " Invalid input, please try again \n";
    }
     
    else
    {
     
    }
     
    return Row;
}
 
int ColumnTest()
 
{
    int Column;
     
    cout << " Please enter a value for the column of the array that is between 2 and 50 as well.\n";
     
    cin >> Column;
     
    while (1 >= Column || Column >= 51)
    {
        cout << " Invalid input, please try again \n";
    }
     
    return Column;
}
 
int ArrayFiller( int Array[50][50] , int Row , int Column )
 
{
     
    for (int i = 0; i < Row; i++)
        for (int k = 0; k < Column; k++)
        {
            Array[i][k] = rand() % 100;
        }
     
    return(ArrayFiller);
}
 
char GetFileName()
{
    cout << " Please enter the name of the file \n";
     
    cin >> FileName;
     
    return(FileName);
}
Last edited on
Topic archived. No new replies allowed.