9
How to print "HackerEarth" with empty main in C++?
C++

Write a C++ program with empty main. Its not allowed to write anything in main().

Solution:- The idea is to create a class, have a cout statement in constructor and create a global object of the class. When the object is created, constructor is called and "HackerEarth" get printed.

class hackers
{
public:
    hackers()
    {
        cout <<"HackerEarth";
     }
}m;

int main()
{

}
Author

Notifications

?