Advertisement
3_2004-2005 Miscellaneous #146078

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

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에서 복구됨