How to print "Something" with empty main in 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 "Something" get printed.
class hackers
{
public:
hackers()
{
cout <<"Something";
}
}m;
int main()
{
}
No comments:
Post a Comment