Lỗi has stopped hardworking lập trình dev c++ năm 2024

I am very new in C++ programing. I tried to write a C++ code, where a matrix from an input file will be created for a given condition[the condition is written as afunction]. After creating the first row of the matrix I get the folloing message:

Filename.exe has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

My input file is as follows [matrix.txt]:

1
2
3
4
5
6
7
8
9
10
11
12
13
  
This is a line, below is another line with numbers
0.15 10.1 15.001
*M
2.5  3.01  4.11
*M
6.16  7.17  8.01
*M
10.16 11.133 12.12
*M
14.17 15.110 16.16

And my code is as follows:

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
// Reading the input file.

# include 

# include 

# include 

# include 

# include 

# include 
using namespace std;
vector read[ifstream& fil, string sec,string fir]
{
    string lines;
    vector data;
        if [fir == sec]
        {
            while [getline[fil,lines]]
            {
                //istringstream is[lines];
                stringstream is[lines];
                data.push_back[vector[istream_iterator[is],
                                              istream_iterator[]]];
            }
        }
    return data;
}
int main[]
{
    int n, m;
    ifstream pa["matrix.txt"];
    vector matr;
    string first, ba["*M"];
    while [pa>>first]
    {
        pa.ignore[numeric_limits ::max[],'\n'];
        matr = read[pa,ba,first];
    }
    n = matr.size[];
    m = matr[0].size[];
    for [ int i = 0; i

Chủ Đề