Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print "Hello world"
- #include <cstdio>
- int main()
- {
- puts("Hello world");
- }
- class A {
- public static void main(String[] args) {
- System.out.print("Hello world");
- }
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstanc, LPSTR lpCmdLine, int iCmdShow)
- {
- HWND hwnd;
- MSG msg;
- WNDCLASSEX wndclass;
- wndclass.cbSize =
- sizeof (wndclass);
- wndclass.style = CS_HREDRAW |
- CS_VREDRAW;
- wndclass.lpfnWndProc =
- WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance =
- hInstance;
- wndclass.hIcon =
- LoadIcon (NULL,
- IDI_APPLICATION);
- wndclass.hCursor =
- LoadCursor (NULL,
- IDC_ARROW);
- wndclass.hbrBackground =
- (HBRUSH) GetStockObject
- (WHITE_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName =
- "HellowWorld";
- wndclass.hIconSm =
- LoadIcon (NULL,
- IDI_APPLICATION);
- RegisterClassEx(&wndclass);
- hwnd =
- CreateWindow("HelloWorld",
- "Hello World Program",
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, hInstance, NULL);
- ShowWindow(hwnd, iCmdShow);
- UpdateWindow(hwnd);
- while(GetMessage(&msg, NULL,
- 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return msg.wParam;
- }
- LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
- {
- HDC hdc;
- PAINTSTRUCT ps;
- switch (iMsg)
- {
- case WM_PAINT:
- hdc = BeginPaint(hwnd,
- &ps);
- TextOut(hdc, 0, 0,
- "Hello World!", 12);
- EndPaint(hwnd, &ps);
- return 0;
- case WM_CHAR:
- case WM_LBUTTONDOWN:
- MessageBox (hwnd, "You
- Clicked me!", "Hello
- World",
- MB_ICONEXCLAMATION);
- RETURN 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- }
- return DefWindowProc(hwnd,
- iMsg, wParam, lParam);
- }
- The Infamous Hello, world! Program.
- Romeo, a young man with a remarkable patience.
- Juliet, a likewise young woman of remarkable grace.
- Ophelia, a remarkable woman much in dispute with Hamlet.
- Hamlet, the flatterer of Andersen Insulting A/S.
- Act I: Hamlet's insults and flattery.
- Scene I: The insulting of Romeo.
- [Enter Hamlet and Romeo]
- Hamlet:
- You lying stupid fatherless big smelly half-witted coward!
- You are as stupid as the difference between a handsome rich brave
- hero and thyself! Speak your mind!
- You are as brave as the sum of your fat little stuffed misused dusty
- old rotten codpiece and a beautiful fair warm peaceful sunny summer's
- day. You are as healthy as the difference between the sum of the
- sweetest reddest rose and my father and yourself! Speak your mind!
- You are as cowardly as the sum of yourself and the difference
- between a big mighty proud kingdom and a horse. Speak your mind.
- Speak your mind!
- [Exit Romeo]
- Scene II: The praising of Juliet.
- [Enter Juliet]
- Hamlet:
- Thou art as sweet as the sum of the sum of Romeo and his horse and his
- black cat! Speak thy mind!
- [Exit Juliet]
- Scene III: The praising of Ophelia.
- [Enter Ophelia]
- Hamlet:
- Thou art as lovely as the product of a large rural town and my amazing
- bottomless embroidered purse. Speak thy mind!
- Thou art as loving as the product of the bluest clearest sweetest sky
- and the sum of a squirrel and a white horse. Thou art as beautiful as
- the difference between Juliet and thyself. Speak thy mind!
- [Exeunt Ophelia and Hamlet]
- Act II: Behind Hamlet's back.
- Scene I: Romeo and Juliet's conversation.
- [Enter Romeo and Juliet]
- Romeo:
- Speak your mind. You are as worried as the sum of yourself and the
- difference between my small smooth hamster and my nose. Speak your
- mind!
- Juliet:
- Speak YOUR mind! You are as bad as Hamlet! You are as small as the
- difference between the square of the difference between my little pony
- and your big hairy hound and the cube of your sorry little
- codpiece. Speak your mind!
- [Exit Romeo]
- Scene II: Juliet and Ophelia's conversation.
- [Enter Ophelia]
- Juliet:
- Thou art as good as the quotient between Romeo and the sum of a small
- furry animal and a leech. Speak your mind!
- Ophelia:
- Thou art as disgusting as the quotient between Romeo and twice the
- difference between a mistletoe and an oozing infected blister! Speak
- your mind!
- [Exeunt]
- #example that prints Hello World!
- Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
- Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
- Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
- Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
- Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
- Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
- Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
- Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
- Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.
- 000100 IDENTIFICATION DIVISION.
- 000200 PROGRAM-ID. HELLOWORLD.
- 000300
- 000400*
- 000500 ENVIRONMENT DIVISION.
- 000600 CONFIGURATION SECTION.
- 000700 SOURCE-COMPUTER. RM-COBOL.
- 000800 OBJECT-COMPUTER. RM-COBOL.
- 000900
- 001000 DATA DIVISION.
- 001100 FILE SECTION.
- 001200
- 100000 PROCEDURE DIVISION.
- 100100
- 100200 MAIN-LOGIC SECTION.
- 100300 BEGIN.
- 100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
- 100500 DISPLAY "Hello world!" LINE 15 POSITION 10.
- 100600 STOP RUN.
- 100700 MAIN-LOGIC-EXIT.
- 100800 EXIT.
- ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
- (=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**
- hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@986543W10/.R,+O<
- [
- uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
- ]
- library LHello
- {
- // bring in the master library
- importlib("actimp.tlb");
- importlib("actexp.tlb");
- // bring in my interfaces
- #include "pshlo.idl"
- [
- uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
- ]
- cotype THello
- {
- interface IHello;
- interface IPersistFile;
- };
- };
- [
- exe,
- uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
- ]
- module CHelloLib
- {
- // some code related header files
- importheader(<windows.h>);
- importheader(<ole2.h>);
- importheader(<except.hxx>);
- importheader("pshlo.h");
- importheader("shlo.hxx");
- importheader("mycls.hxx");
- // needed typelibs
- importlib("actimp.tlb");
- importlib("actexp.tlb");
- importlib("thlo.tlb");
- [
- uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
- aggregatable
- ]
- coclass CHello
- {
- cotype THello;
- };
- };
- #include "ipfix.hxx"
- extern HANDLE hEvent;
- class CHello : public CHelloBase
- {
- public:
- IPFIX(CLSID_CHello);
- CHello(IUnknown *pUnk);
- ~CHello();
- HRESULT __stdcall PrintSz(LPWSTR pwszString);
- private:
- static int cObjRef;
- };
- #include <windows.h>
- #include <ole2.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "thlo.h"
- #include "pshlo.h"
- #include "shlo.hxx"
- #include "mycls.hxx"
- int CHello::cObjRef = 0;
- CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
- {
- cObjRef++;
- return;
- }
- HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString)
- {
- printf("%ws
- ", pwszString);
- return(ResultFromScode(S_OK));
- }
- CHello::~CHello(void)
- {
- // when the object count goes to zero, stop the server
- cObjRef--;
- if( cObjRef == 0 )
- PulseEvent(hEvent);
- return;
- }
- #include <windows.h>
- #include <ole2.h>
- #include "pshlo.h"
- #include "shlo.hxx"
- #include "mycls.hxx"
- HANDLE hEvent;
- int _cdecl main(
- int argc,
- char * argv[]
- ) {
- ULONG ulRef;
- DWORD dwRegistration;
- CHelloCF *pCF = new CHelloCF();
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- // Initialize the OLE libraries
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
- CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
- REGCLS_MULTIPLEUSE, &dwRegistration);
- // wait on an event to stop
- WaitForSingleObject(hEvent, INFINITE);
- // revoke and release the class object
- CoRevokeClassObject(dwRegistration);
- ulRef = pCF->Release();
- // Tell OLE we are going away.
- CoUninitialize();
- return(0); }
- extern CLSID CLSID_CHello;
- extern UUID LIBID_CHelloLib;
- CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
- 0x2573F891,
- 0xCFEE,
- 0x101A,
- { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
- };
- UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
- 0x2573F890,
- 0xCFEE,
- 0x101A,
- { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
- };
- #include <windows.h>
- #include <ole2.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #include "pshlo.h"
- #include "shlo.hxx"
- #include "clsid.h"
- int _cdecl main(
- int argc,
- char * argv[]
- ) {
- HRESULT hRslt;
- IHello *pHello;
- ULONG ulCnt;
- IMoniker * pmk;
- WCHAR wcsT[_MAX_PATH];
- WCHAR wcsPath[2 * _MAX_PATH];
- // get object path
- wcsPath[0] = '