Advertisement
C_Volume2 Miscellaneous #81843

Code Example - Hello World without using the main function

This is kind of a neat little trick you can do using a classes constructor to have code execute before the main function.

AI

एआई सारांश: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

सोर्स कोड
original-source
/* Program Example
  hello world
 
 written by Jared Bruni
 www.LostSideDead.com
*/

#include <iostream>
using namespace std;

class Program 
{
public:
	inline Program()
	{
		main();
	}
	void main()
	{
		cout << "hello world" << endl;
		system("pause");
	}
};
Program prog;
int main()
{
	cout << "Hello World Part2" << endl;
	system("pause");
	return (0);
}
मूल टिप्पणियाँ (3)
Wayback Machine से पुनर्प्राप्त