Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
414 B
1
Indexable
Never
double** read_mat(string filename, int* size)
{
    int i;
    ifstream infile(filename);
    if (!infile)
    {
        return 0;
    }
    infile >> *size;
    string s;
    double** mat = new double* [*size];
    for (int i = 0; i < *size; i++)
    {
        for (int j = 0; j < *size; j++)
        {
            infile >> mat[i][j];
        }
    }
    infile.close();
    return mat;
}