C++
x
20
1
2
3
4
5
double lowl[3][6];
6
ifstream test1("hi.txt");
7
8
int main()
9
{
10
11
for (int i = 0; i<2; i++){
12
for (int j = 0; j<6; j++){
13
14
test1 >> lowl[i][j];
15
cout << lowl[i][j] << " ";
16
}
17
cout << endl;
18
19
}
20
}
$ g++ prog.cc -Wall -Wextra -std=c++11 -pedantic
Start
prog.cc:6:1: error: 'ifstream' does not name a type 6 | ifstream test1("hi.txt"); | ^~~~~~~~ prog.cc: In function 'int main()': prog.cc:14:9: error: 'test1' was not declared in this scope 14 | test1 >> lowl[i][j]; | ^~~~~ prog.cc:15:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 15 | cout << lowl[i][j] << " "; | ^~~~ | std::cout In file included from prog.cc:1: /opt/wandbox/gcc-11.1.0/include/c++/11.1.0/iostream:61:18: note: 'std::cout' declared here 61 | extern ostream cout; /// Linked to standard output | ^~~~ prog.cc:17:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 17 | cout << endl; | ^~~~ | std::cout In file included from prog.cc:1: /opt/wandbox/gcc-11.1.0/include/c++/11.1.0/iostream:61:18: note: 'std::cout' declared here 61 | extern ostream cout; /// Linked to standard output | ^~~~ prog.cc:17:13: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 17 | cout << endl; | ^~~~ | std::endl In file included from /opt/wandbox/gcc-11.1.0/include/c++/11.1.0/iostream:39, from prog.cc:1: /opt/wandbox/gcc-11.1.0/include/c++/11.1.0/ostream:681:5: note: 'std::endl' declared here 681 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
1
Finish