几乎所有编程语言的hello, world程序(1) (4)

C-OpenGL

/* "Hello World" in C using OGL - Open Graphics Library */ #include <GL/glut.h> #define font GLUT_BITMAP_HELVETICA_18 #define tx "Hello World!" void text(void) { char *p, tex[] = tx; p = tex; glColor3d(1.0, 1.0, 0.0); glRasterPos2d(-.5, 0.); while(*p) glutBitmapCharacter(font, *p++); } void display() { glClear(GL_COLOR_BUFFER_BIT); text(); glFlush(); } void reshape(int width, int height) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1, 1, -1, 1, -1, 1); glMatrixMode(GL_MODELVIEW); display(); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(50, 50); glutInitWindowSize(500, 500); glutCreateWindow("Hello World OpenGL"); glClearColor(0,0,0,0); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); return 0; } C-PresManager /* Hello World for C with PresentationManager / OS/2 2.11 */ #define INCL_WIN #include <os2.h> int main( void ) { HMQ hmq; hmq = WinCreateMsgQueue( 0, 0 ); WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, (PSZ)"Hello World!", (PSZ)"", 0, MB_OK ); WinDestroyMsgQueue( hmq ); return 0; } C-Windows /* Hello world in C for MS-Windows */ #include <windows.h> int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR CmdLine, int Show) { MessageBox(GetActiveWindow(), "Hello World!", "Hello Windows World", MB_OK); return 0; } C-X11-Athena /* Hello World in C with X11 using Athena widgets */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Label.h> main(int argc,char **argv) { XtAppContext app_context; Widget toplevel,hello; toplevel = XtVaAppInitialize(&app_context,"XHello",NULL,0, &argc,argv,NULL,NULL); hello = XtVaCreateManagedWidget("Hello World!",labelWidgetClass, toplevel,(void*)0); XtRealizeWidget(toplevel); XtAppMainLoop(app_context); return 0; } Caché Object Script HelloWorld ;Hello World in Cache Object Script Start ; Write "Hello world" Quit CAML-Light (* Hello World in CAML Light *) let hello = print_string "Hello World!"; ;; Casio BASIC \'Hello World in Casio-Basic. [new line symbol here (press EXE)] "Hello World!" CDuce (* Hello World in CDuce *) print "Hello World!\n";; Centura ! Hello World in Centura Function: HelloWorld Description: Returns Parameters Static Variables Local variables Actions Call SalMessageBox( \'Hello World\',\'Message\',MB_Ok) Chef Hello World Souffle. This recipe prints the immortal words "Hello world!", in a basically brute force way. It also makes a lot of food for one person. Ingredients. 72 g haricot beans 101 eggs 108 g lard 111 cups oil 32 zucchinis 119 ml water 114 g red salmon 100 g dijon mustard 33 potatoes Method. Put potatoes into the mixing bowl. Put dijon mustard into the mixing bowl. Put lard into the mixing bowl. Put red salmon into the mixing bowl. Put oil into the mixing bowl. Put water into the mixing bowl. Put zucchinis into the mixing bowl. Put oil into the mixing bowl. Put lard into the mixing bowl. Put lard into the mixing bowl. Put eggs into the mixing bowl. Put haricot beans into the mixing bowl. Liquefy contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish. Serves 1. CICS-COBOL -- Hello World in CICS COBOL 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLO. 000300 * HELLO WORLD IN CICS COBOL. 000400 AUTHOR. ROBERT GOSLING. 000500 ENVIRONMENT DIVISION. 000600 DATA DIVISION. 000700 WORKING-STORAGE SECTION. 000800 01 WS-DATA-AREA PIC X(80) VALUE "HELLO WORLD!". 000900 PROCEDURE DIVISION. 001000 EXEC CICS SEND FROM (WS-DATA-AREA) END-EXEC. 001100 EXEC CICS RETURN END-EXEC. Clarion !Hello World in Clarion PROGRAM MAP END CODE MESSAGE(\'Hello World!\') RETURN Clean // Hello World in Clean module hello Start :: String Start = "Hello World!\n" Clipper // Hello World in Clipper ? "Hello World" Clojure ; Hello world in Clojure (defn hello [] (println "Hello world!")) (hello) CLP /* Hello World in CLP for the IBM AS/400 */ PGM SNDPGMMSG MSG(\'Hello World !\') MSGTYPE(*COMP) ENDPGM CMake # Hello World in CMake message(STATUS "Hello World!") COBOL * Hello World in COBOL ***************************** IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. ENVIRONMENT DIVISION. DATA DIVISION. PROCEDURE DIVISION. MAIN SECTION. DISPLAY "Hello World!" STOP RUN. **************************** Cobra """Hello world in Cobra""" class Hello def main print \'Hello, world.\' Cocoa // Hello World in Cocoa Obj-C (OS X) #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Hello, World!"); [pool release]; return 0; } CoDScript // Hello world in CoDScript main(){ iPrintLnBold("Hello World!"); } ColdFusion <!--- Hello world in ColdFusion---> <cfset message = "Hello World"> <cfoutput> #message#</cfoutput> CommandScript #Hello World in Command Script 3.1 #Meta.Name: "Hello World" #Block(Main).Start echo "Hello World!" #Block(Main).End Common Lisp ;;; Hello world in Common Lisp (print "Hello World") Console-Postscript %% Hello World in Console PostScript serverdict begin 0 exitserver /Courier findfont 48 scalefont setfont 22 22 moveto (Hello World!) show showpage %% End Cool -- Hello World in Cool class Main inherits IO{ main():Object{ out_string("Hello, world!\n") }; }; CoolBasic \' Hello World in CoolBasic print "hello world" wait key CSS /* Hello World in CSS */ body:before { content: "Hello World"; } CYBOL <!-- Hello World in Cybernetics Oriented Language (CYBOL) --> <model> <part name="send_message" channel="inline" abstraction="operation" model="send"> <property name="channel" channel="inline" abstraction="character" model="shell"/> <property name="message" channel="inline" abstraction="character" model="Hello, World!"/> </part> <part name="exit_application" channel="inline" abstraction="operation" model="exit"/> </model>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwgsww.html