The code presented by you in a C++ program. You need to save it in file.cpp
format, after that you need to compile with g++ file.cpp
and it should work.
You have saved it file.c
format and compiling it with gcc
, which is C standard, not C++.
solved can’t understand “std::cout”