void main()
{
Console::WriteLine(“Hello World”);
}
C++-Epoc
// Hello World in C++, Epoc style (for Symbian OS)
#include <eikapp.h>
#include <eikdoc.h>
#include <eikappui.h>
class CHelloWorldAppUi;
class CEikApplication;
class CHelloWorldAppView;
class CHelloWorldApplication :
public CEikApplication
{
public:
TUid
AppDllUid()
const;
protected:
CApaDocument*
CreateDocumentL();
};
class CHelloWorldDocument :
public CEikDocument
{
public:
static CHelloWorldDocument*
NewL(CEikApplication& aApp);
static CHelloWorldDocument* NewLC(CEikApplication& aApp);
~CHelloWorldDocument(){};
public:
CEikAppUi*
CreateAppUiL();
private:
void ConstructL() {};
CHelloWorldDocument(CEikApplication& aApp){};
};
class CHelloWorldAppUi :
public CEikAppUi
{
public:
void ConstructL();
CHelloWorldAppUi(){};
~CHelloWorldAppUi(){};
};
static const TUid KUidHelloWorldApp = {
0x10005B91};
GLDEF_C TInt E32Dll(TDllReason )
{
return KErrNone;
}
EXPORT_C CApaApplication* NewApplication()
{
return (
new CHelloWorldApplication);
}
CApaDocument* CHelloWorldApplication::CreateDocumentL()
{
CApaDocument* document = CHelloWorldDocument::NewL(*
this);
return document;
}
TUid CHelloWorldApplication::AppDllUid()
const
{
return KUidHelloWorldApp;
}
CHelloWorldDocument* CHelloWorldDocument::NewL(CEikApplication& aApp)
{
CHelloWorldDocument* self = NewLC(aApp);
CleanupStack::Pop(self);
return self;
}
CHelloWorldDocument* CHelloWorldDocument::NewLC(CEikApplication& aApp)
{
CHelloWorldDocument* self =
new (ELeave) CHelloWorldDocument(aApp);
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CEikAppUi* CHelloWorldDocument::CreateAppUiL()
{
CEikAppUi* appUi =
new (ELeave) CHelloWorldAppUi;
return appUi;
}
void CHelloWorldAppUi::ConstructL()
{
BaseConstructL();
_LIT(message,
"Hello!");
CAknInformationNote* informationNote =
new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(message);
}
C++-FLTK
// Hello World in C++-FLTK
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main(
int argc,
char **argv) {
Fl_Window *ventana =
new Fl_Window(
300,
180);
ventana->begin();
Fl_Box *box =
new Fl_Box(
20,
40,
260,
100,
"Hello World!");
box->labelsize(
50);
ventana->end();
ventana->show(argc, argv);
return Fl::run();
}
C++-gtkmm
// Hello World in C++ for the Gtk+ toolkit
#include <gtkmm/main.h>
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <iostream>
void button_clicked()
{
std::
cout <<
"Hello, World !" <<
std::endl;
}
int main (
int argc,
char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window hello_window;
Gtk::Button hello_button(
"Hello World");
hello_window.set_border_width(
10);
hello_window.add(hello_button);
hello_button.signal_clicked().connect(sigc::ptr_fun(&button_clicked));
hello_button.show();
Gtk::Main::run(hello_window);
return 0;
}
C++-ISO
// Hello World in ISO C++
#include <iostream>
int main()
{
std::
cout <<
"Hello World!" <<
std::endl;
}
C++-MFC
// Hello World in C++ for Microsoft Foundation Classes
// (Microsoft Visual C++).
#include <afxwin.h>
class CHello :
public CFrameWnd
{
public:
CHello()
{
Create(NULL,_T(
"Hello World!"),WS_OVERLAPPEDWINDOW,rectDefault);
}
};
class CHelloApp :
public CWinApp
{
public:
virtual BOOL
InitInstance();
};
BOOL CHelloApp::InitInstance()
{
m_pMainWnd =
new CHello();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
CHelloApp theApp;
C++-Qt
// Hello World in C++ for the Qt framework
#include <qapplication.h>
#include <qlabel.h>
int main(
int argc,
char *argv[])
{
QApplication a(argc, argv);
QLabel l(
"Hello World!",
0);
l.setCaption(
"Test");
l.setAlignment(Qt::AlignCenter);
l.resize(
300,
200);
a.setMainWidget(&l);
l.show();
return(a.exec());
}
C-AL
OBJECT Codeunit 50000 HelloWorld
{
PROPERTIES
{
OnRun=
BEGIN
//Hello World in C/AL (Microsoft Business Solutions-Navision)
MESSAGE(Txt001);
END;
}
CODE
{
VAR
Txt001@1000000000 : TextConst \'ENU=Hello World\';
BEGIN
END.
}
}
C-AmigaAnywhere
/* Hello World in C for Amiga Anywhere 2 (AA2) */
#include <aa.h>
int aaMain(
int argc,
char **argv)
{
aaOpenDisplay(
200,
200,
16,
"Hello World", FAA_DISPLAY_WINDOW);
aaDrawString(AA_DISPLAY_PIXMAP,
"Hello, world!",
20,
20, AA_DEFAULT_FONT,
0xffff00,
0, FAA_FONT_INK, -
1);
aaUpdate();
aaWaitInput();
return 0;
}
C-ANSI
/* Hello World in C, Ansi-style */
#include <stdio.h>
#include <stdlib.h>
int main(
void)
{
puts(
"Hello World!");
return EXIT_SUCCESS;
}
C-Curses
/* Hello World in C for Curses */
#include <curses
.h>
main()
{
initscr();
addstr("Hello World!\n");
refresh();
endwin();
return 0;
}
C-GEM
/
* Hello World for C with GEM */
#include <aes.h>
main()
{
appl_init();
form_alert(1,"[
0][
Hello World!][
Ok]");
appl_exit();
return 0;
}
C-Intuition
/* Hello World in C for Intution (Amiga GUI) */
#include <intuition/intuition.h>
struct IntuitionBase *IntuitionBase =
NULL;
struct IntuiText hello_text = {-
1,-
1,JAM1,
0,
0,
NULL,
"Hello World!",
NULL };
struct IntuiText ok_text = {-
1,-
1,JAM1,
0,
0,
NULL,
"Ok",
NULL };
void main(
void)
{
IntuitionBase = (
struct IntuitionBase *)
OpenLibrary(
"intuition.library",
0);
AutoRequest(
NULL, &hello_text,
NULL, &ok_text,
NULL,
NULL,
100,
50);
CloseLibrary(IntuitionBase);
}
C-K+R
/* Hello World in C, K&R-style */
main()
{
puts("Hello World!");
return 0;
}
C-Objective
/* Hello World
in Objective-C.
** Since
the standard implementation
is identical
to K&R C,
** a
version that says hello
to a
set of people passed
on
**
the command line
is shown here.
*/
#include <stdio.h>
#include <objpak.h>
int main(int argc,char **argv)
{
id set = [Set new];
argv++;
while (
--argc) [set add:[String str:*argv++]];
[
set do:{ :each | printf(
"hello, %s!\n",[each str]); }];
return 0;
}