error: ‘_1’ was not declared in this scope code example

Example 1: error: ‘cout’ was not declared in this scope

#include <iostream>
using namespace std;

adding above two lines before main will help you

NOTE:
note: suggested alternative:
In file included from class.cpp:1:0:
/usr/include/c++/7/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^~~~

Example 2: error: 'endl' was not declared in this scope

using namespace std;

Explanation:
mention "using namespace std;" above the main function in C++ will solve the 'endl' error

Tags:

C Example