Skinbase.org Skinbase.org

The Evolution of a Programmer

By Gregor Klevže
484 views 16 replies
Gregor Klevže avatar
Gregor Klevže
Member
OP
High School/Jr.High <BR> =================== <BR> 10 PRINT &quot;HELLO WORLD&quot; <BR> 20 END
Gregor Klevže avatar
Gregor Klevže
Member
First year in College <BR> ===================== <BR> program Hello(input, output) <BR> begin <BR> writeln(&acute;Hello World&acute;) <BR> end. <BR>
Gregor Klevže avatar
Gregor Klevže
Member
Senior year in College <BR> ====================== <BR> (defun hello <BR> (print <BR> (cons &acute;Hello (list &acute;World)))) <BR>
Gregor Klevže avatar
Gregor Klevže
Member
New professional <BR> ================ <BR> #include <stdio.h> <BR> void main(void) <BR> { <BR> char *message[] = {&quot;Hello &quot;, &quot;World&quot;}; <BR> int i; <BR> <BR> for(i = 0; i < 2; ++i) <BR> printf(&quot;%s&quot;, message[i]); <BR> printf(&quot;\n&quot;); <BR> } <BR>
Gregor Klevže avatar
Gregor Klevže
Member
Seasoned professional <BR> ===================== <BR> #include <iostream.h> <BR> #include <string.h> <BR> <BR> class string <BR> { <BR> private: <BR> int size; <BR> char *ptr; <BR> <BR> public: <BR> string() : size(0), ptr(new char(&acute;\0&acute;)) {} <BR> <BR> string(const string &s) : size(s.size) <BR> { <BR> ptr = new char[size + 1]; <BR> strcpy(ptr, s.ptr); <BR> } <BR> <BR> ~string() <BR> { <BR> delete [] ptr; <BR> } <BR> <BR> friend ostream &operator <<(ostream &, const string &); <BR> string &operator=(const char *); <BR> }; <BR> <BR> ostream &operator<<(ostream &stream, const string &s) <BR> { <BR> return(stream << s.ptr); <BR> } <BR> <BR> string &string::operator=(const char *chrs) <BR> { <BR> if (this != &chrs) <BR> { <BR> delete [] ptr; <BR> size = strlen(chrs); <BR> ptr = new char[size + 1]; <BR> strcpy(ptr, chrs); <BR> } <BR> return(*this); <BR> } <BR> <BR> int main() <BR> { <BR> string str; <BR> <BR> str = &quot;Hello World&quot;; <BR> cout << str << endl; <BR> <BR> return(0) ; <BR> } <BR>
Gregor Klevže avatar
Gregor Klevže
Member
Master Programmer <BR> ================= <BR> [ <BR> uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820) <BR> ] <BR> library LHello <BR> { <BR> // bring in the master library <BR> importlib(&quot;actimp.tlb&quot;); <BR> importlib(&quot;actexp.tlb&quot;); <BR> <BR> // bring in my interfaces <BR> #include &quot;pshlo.idl&quot; <BR> <BR> [ <BR> uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820) <BR> ] <BR> cotype THello <BR> { <BR> interface IHello; <BR> interface IPersistFile; <BR> }; <BR> }; <BR> <BR> [ <BR> exe, <BR> uuid(2573F890-CFEE-101A-9A9F-00AA00342820) <BR> ] <BR> module CHelloLib <BR> { <BR> <BR> // some code related header files <BR> importheader(<windows.h>); <BR> importheader(<ole2.h>); <BR> importheader(<except.hxx>); <BR> importheader(&quot;pshlo.h&quot;); <BR> importheader(&quot;shlo.hxx&quot;); <BR> importheader(&quot;mycls.hxx&quot;); <BR> <BR> // needed typelibs <BR> importlib(&quot;actimp.tlb&quot;); <BR> importlib(&quot;actexp.tlb&quot;); <BR> importlib(&quot;thlo.tlb&quot;); <BR> <BR> [ <BR> uuid(2573F891-CFEE-101A-9A9F-00AA00342820), <BR> aggregatable <BR> ] <BR> coclass CHello <BR> { <BR> cotype THello; <BR> }; <BR> }; <BR> <BR> <BR> #include &quot;ipfix.hxx&quot; <BR> <BR> extern HANDLE hEvent; <BR> <BR> class CHello : public CHelloBase <BR> { <BR> public: <BR> IPFIX(CLSID_CHello); <BR> <BR> CHello(IUnknown *pUnk); <BR> ~CHello(); <BR> <BR> HRESULT __stdcall PrintSz(LPWSTR pwszString); <BR> <BR> private: <BR> static int cObjRef; <BR> }; <BR> <BR> <BR> #include <windows.h> <BR> #include <ole2.h> <BR> #include <stdio.h> <BR> #include <stdlib.h> <BR> #include &quot;thlo.h&quot; <BR> #include &quot;pshlo.h&quot; <BR> #include &quot;shlo.hxx&quot; <BR> #include &quot;mycls.hxx&quot; <BR> <BR> int CHello::cObjRef = 0; <BR> <BR> CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk) <BR> { <BR> cObjRef++; <BR> return; <BR> } <BR> <BR> HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString) <BR> { <BR> printf(&quot;%ws\n&quot;, pwszString); <BR> return(ResultFromScode(S_OK)); <BR> } <BR> <BR> <BR> CHello::~CHello(void) <BR> { <BR> <BR> // when the object count goes to zero, stop the server <BR> cObjRef--; <BR> if( cObjRef == 0 ) <BR> PulseEvent(hEvent); <BR> <BR> return; <BR> } <BR> <BR> #include <windows.h> <BR> #include <ole2.h> <BR> #include &quot;pshlo.h&quot; <BR> #include &quot;shlo.hxx&quot; <BR> #include &quot;mycls.hxx&quot; <BR> <BR> HANDLE hEvent; <BR> <BR> int _cdecl main( <BR> int argc, <BR> char * argv[] <BR> ) { <BR> ULONG ulRef; <BR> DWORD dwRegistration; <BR> CHelloCF *pCF = new CHelloCF(); <BR> <BR> hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); <BR> <BR> // Initialize the OLE libraries <BR> CoInitializeEx(NULL, COINIT_MULTITHREADED); <BR> <BR> CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER, <BR> REGCLS_MULTIPLEUSE, &dwRegistration); <BR> <BR> // wait on an event to stop <BR> WaitForSingleObject(hEvent, INFINITE); <BR> <BR> // revoke and release the class object <BR> CoRevokeClassObject(dwRegistration); <BR> ulRef = pCF->Release(); <BR> <BR> // Tell OLE we are going away. <BR> CoUninitialize(); <BR> <BR> return(0); <BR> } <BR> <BR> extern CLSID CLSID_CHello; <BR> extern UUID LIBID_CHelloLib; <BR> <BR> CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */ <BR> 0x2573F891, <BR> 0xCFEE, <BR> 0x101A, <BR> { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } <BR> }; <BR> <BR> UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */ <BR> 0x2573F890, <BR> 0xCFEE, <BR> 0x101A, <BR> { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } <BR> }; <BR> <BR> #include <windows.h> <BR> #include <ole2.h> <BR> #include <stdlib.h> <BR> #include <string.h> <BR> #include <stdio.h> <BR> #include &quot;pshlo.h&quot; <BR> #include &quot;shlo.hxx&quot; <BR> #include &quot;clsid.h&quot; <BR> <BR> int _cdecl main( <BR> int argc, <BR> char * argv[] <BR> ) { <BR> HRESULT hRslt; <BR> IHello *pHello; <BR> ULONG ulCnt; <BR> IMoniker * pmk; <BR> WCHAR wcsT[_MAX_PATH]; <BR> WCHAR wcsPath[2 * _MAX_PATH]; <BR> <BR> // get object path <BR> wcsPath[0] = &acute;\0&acute;; <BR> wcsT[0] = &acute;\0&acute;; <BR> if( argc > 1) { <BR> mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1); <BR> wcsupr(wcsPath); <BR> } <BR> else { <BR> fprintf(stderr, &quot;Object path must be specified\n&quot;); <BR> return(1); <BR> } <BR> <BR> // get print string <BR> if(argc > 2) <BR> mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1); <BR> else <BR> wcscpy(wcsT, L&quot;Hello World&quot;); <BR> <BR> printf(&quot;Linking to object %ws\n&quot;, wcsPath); <BR> printf(&quot;Text String %ws\n&quot;, wcsT); <BR> <BR> // Initialize the OLE libraries <BR> hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED); <BR> <BR> if(SUCCEEDED(hRslt)) { <BR> <BR> <BR> hRslt = CreateFileMoniker(wcsPath, &pmk); <BR> if(SUCCEEDED(hRslt)) <BR> hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello); <BR> <BR> if(SUCCEEDED(hRslt)) { <BR> <BR> // print a string out <BR> pHello->PrintSz(wcsT); <BR> <BR> Sleep(2000); <BR> ulCnt = pHello->Release(); <BR> } <BR> else <BR> printf(&quot;Failure to connect, status: %lx&quot;, hRslt); <BR> <BR> // Tell OLE we are going away. <BR> CoUninitialize(); <BR> } <BR> <BR> return(0); <BR> } <BR> <BR># END: return programmer to real world <BR>
Gregor Klevže avatar
Gregor Klevže
Member
Manager <BR> ======= <BR> <BR>Say, can you make me a program that prints out &quot;Hello, World.&quot;? <BR> <BR>
brub avatar
brub
Member
I did not know you had Smileys in php. i&acute;ll have to go back and learn that part :)
snowman avatar
snowman
Member
hehe... you need help gRAVE ;)
pk avatar
pk
Member
hehe, cool
scarebear avatar
scarebear
Member
I&acute;m a new professional ;)
pogrelz avatar
pogrelz
Member
/me laughs at brub, not about the smilies part ;)
xymantix avatar
xymantix
Member
I must be in high school :(
scarebear avatar
scarebear
Member
Yeah.....right ;)
chichigirl46 avatar
chichigirl46
Member
are we gonna be graded on this test :-(
bugzlitey avatar
bugzlitey
Member
lol...damm high school... I&acute;m in pre k..... :( lol
Sign in to post a reply.