Hi i need a little help. i want to read a multi array from a file but code blocks said a lots of error and i dont know whats the problem. can u help me?

#include <iostream>
#include <cstdlib>
#include <math.h>
#include <fstream>
#include <sstream>

using namespace std;
int maxn=100;
int maxm=100;

void beolv(string filename, int &n, int &m, int x[maxn][maxm]) {
 //fájl megnyitása
 ifstream fin(filename.c_str(), ios::in);

    fin >> n;
    fin >> m;
    for (int i=0; i<n; i++)
        for (int j=0; j<m; j++)
            fin >> x[i][j];

int main()
    int n;
    int m;
    int x[maxn][maxm];
    cout << "" << endl;
    return 0;

You must #include<string> to use the string class.

C++ does not allow variable size array - you must make maxn and maxm const

You must put a semi-colon on the end of beolv("test.txt",n,m,x)

Edited 5 Years Ago by Moschops: n/a

This question has already been answered. Start a new discussion instead.