Hello World

xiaoxiao2021-03-06  41

High School / Jr.high Time Middle School Code 10 Print "Hello World" End First Year in College Program PROGRAM Hello (Input, Output) Begin Writeln ('Hello World') end. Senior year in college's high-grade program code (defun Hello)) New Professional Become a new personnel of the company #include void main (void) {char * Message [] = {"Hello", "world"}; int i; for (i = 0; i <2; i) Printf ("% s", message [i]); printf ("/ n ");} Seasoned Professional Entering the company for two years #include #include class string {private: int size; char * ptr; public: string (): size (0), PTR (New char ('/ 0')) {} string (const string & s): size (size) {ptr = new char [size 1]; struct (ptr, s.ptr);} ~ String () {delete [] PTR;} Friend Ostream & Operator << (Ostream &, Const String &); String & Operator = (Const Char *);}; Ostream & Operator << (Ostream & Stream, Const String & S) {Return ( Stream << S.ptr);} string & string :: Operator = (const char * chrs) {if (this! = & chrs) {delete [] Ptr; size = strlen (chrs); ptr = new char [size 1 ]; STRCPY (PTR, CHRS);} return (* this);

} Int main () {string Str; str = "hello world"; cout << str << endl; return (0);} Master Programmer upgraded into the program of the Software Manager (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; importheader (); importheader ("pshlo.h"); importheader ("shlo.hxx"); importhe ADER ("mycls.hxx"); // Needed type iv ("actimp.tlb"); importlib ("actexp.tlb"); importlib ("thro.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 #include #include #include #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 / n ", pwszstring; return (resultfromscode (s_ok));} chello :: ~ chello (void) {//hen the object count goes to zero, stop the server cobjref -; if (cobjref == 0) PulseEvent (HEVENT);} #include #include #include "pshlo.h" #include "shlo.hxx" #include "mycls.hxx" Handle HEVENT; INT _CDECL Main) Argc, char * argv []) {ulong ulref; dword dwregistration; chellocf * pcf = n ew 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 #include #include #include #include #include "pshlo.h" #include "shlo.hxx" #include "clsid.h" INT _CDECL Main (int Argc Char * argv []) {HRESULT HRSLT;

Ihello * phello; ulong ulcnt; ivoniker * pmk; wchar wcst [_max_path]; wchar wcspath [2 * _max_path]; // Get Object path wcspath [0] = '/ 0'; WCST [0] = '/ 0'; IF (Argc 1) {MBSTOWCS (WCSPATH, Argv [1], Strlen (Argv [1]) 1); WCSUPR (WCSPATH);} else {fprintf (stderr, "object path must be specified / n"); Return (1);} // Get Print String if (argc 2) MBstowcs (WCST, Argv [2], Strlen (Argv [2]) 1); Else Wcscpy (WCST, L "Hello World"); Printf (" Linking to Object% WS / N ", WCSPATH); Printf (" Text String% WS / N ", WCST); // Initialize The Ole Libraries HrsLt = CoinitializeEx (NULL, COINIT_MULTITHREADED); if (succeeded) {HRSLT = CreateFilemoniker (WCSPATH, & PMK); if (succeededed (hrslt)) hrslt = bindmoniker (PMK, 0, IID_IHELLO, (Void **) & Phello); if (succeeded (HRSLT)) { // Print A String Out Phello-Printsz (WCST); ULCNT = Phello-release ();} else printf ("Failure to Connect, Status:% lx", HRSLT); // Tell Ole We Are Going away ();} return (0);} Apprentice Hacker hacker disciples stage #! / usr / local / bin / perl $ msg = "hello, world./n"; if ($ # argv = 0) {While ($ arg = shift (@argv))) {$ outfilename = $ arg; open (file, "". $ Outfilename) || DIE "Can't Write $ Arg: $! / N";

转载请注明原文地址:https://www.9cbs.com/read-78497.html

New Post(0)