<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>██▓▓▒▒░░ ɔɔ˙ǝɹ0ɔ˙ʍʍʍ ░░▒▒▓▓█ &#187; c++</title>
	<atom:link href="http://blog.c0re.cc/category/source-code/c/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.c0re.cc</link>
	<description>Dreaming in digital, Talking in VoIP, Living in real time, Writing in C++, Java, C#.... Welcome to my world!</description>
	<lastBuildDate>Sat, 21 Aug 2010 18:15:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Programas &#8220;Hola mundo&#8221;</title>
		<link>http://blog.c0re.cc/2009/07/source-code/c-sharp/programas-hola-mundo.html</link>
		<comments>http://blog.c0re.cc/2009/07/source-code/c-sharp/programas-hola-mundo.html#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:42:22 +0000</pubDate>
		<dc:creator>Jose Antonio Bueno</dc:creator>
				<category><![CDATA[c# .Net]]></category>
		<category><![CDATA[c++]]></category>

		<guid isPermaLink="false">http://blog.antoniobs.net/?p=748</guid>
		<description><![CDATA[Cuando un programador inicia a prender un nuevo lenguaje de programacion es muy tipico iniciar con el famoso &#8220;Hola mundo&#8221;, que no es mas que un simple ejemplo de un nuevo programa de computadora en donde aparece la leyenda &#8220;Hola mundo&#8221;. Â  Y aqui les dejo una pequeÃ±a compilacion para los nuevos programadores: Suerte! Â  [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando un programador inicia a prender un nuevo lenguaje de programacion es muy tipico iniciar con el famoso &#8220;Hola mundo&#8221;, que no es mas que un simple ejemplo de un nuevo programa de computadora en donde aparece la leyenda &#8220;Hola mundo&#8221;.</p>
<p>Â </p>
<p>Y aqui les dejo una pequeÃ±a compilacion para los nuevos programadores:</p>
<p>Suerte! <img src='http://blog.c0re.cc/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Â </p>
<p>Â dot Net Linq Programmer<br />
Â Â Â  ===================</p>
<pre class="brush: csharp">

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JABS.VS2010.win32k
{
Â Â Â  class Program
Â Â Â  {
Â Â Â Â Â Â Â  static void Main(string[] args)
Â Â Â Â Â Â Â  {
Â Â Â Â Â Â Â Â Â Â Â  string[] helloWorld = { &quot;Hello&quot;, &quot;Jose&quot;, &quot;Antonio&quot;, &quot;Bueno!&quot;, &quot;World&quot;, &quot;www.antoniobs.net&quot; };

Â Â Â Â Â Â Â Â Â Â Â  try
Â Â Â Â Â Â Â Â Â Â Â  {
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  var helloLinq = from word in helloWorld
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  where word.Length == 5
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  select word;

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  foreach (string s in helloLinq)
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Console.Write(s + &quot; &quot;);
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 
Â Â Â Â Â Â Â Â Â Â Â  }
Â Â Â Â Â Â Â Â Â Â Â  catch (Exception err)
Â Â Â Â Â Â Â Â Â Â Â  {
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Console.WriteLine(err.Message);
Â Â Â Â Â Â Â Â Â Â Â  }
Â Â Â Â Â Â Â Â Â Â Â  finally
Â Â Â Â Â Â Â Â Â Â Â  {
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Console.WriteLine(&quot;nPress a key to continue...&quot;);
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Console.ReadKey();
Â Â Â Â Â Â Â Â Â Â Â  }
Â Â Â Â Â Â Â Â Â Â Â 
Â Â Â Â Â Â Â  }
Â Â Â  }
}
</pre>
<p>Â </p>
<p>Â </p>
<p>Â High School/Jr.High<br />
Â Â Â  ===================</p>
<pre class="brush: vb">

Â Â Â  10 PRINT &quot;HELLO WORLD&quot;
Â Â Â  20 END
</pre>
<p>Â Â Â  First year in College<br />
Â Â Â  =====================</p>
<pre class="brush: vb">
Â Â Â  program Hello(input, output)
Â Â Â Â Â  begin
writeln(&#039;Hello World&#039;)
Â Â Â Â Â  end.

Â </pre>
<p>Senior year in College<br />
Â Â Â  ======================</p>
<pre class="brush: vb">
Â Â Â  (defun hello
Â Â Â Â Â  (print
(cons &#039;Hello (list &#039;World))))
</pre>
<p>Â </p>
<p>New professional<br />
================</p>
<pre class="brush: c++">

Â Â Â Â  #include &lt;stdio.h&gt;
Â Â Â  void main(void)
Â Â Â  {
Â Â Â Â Â  char *message[] = {&quot;Hello &quot;, &quot;World&quot;};
Â Â Â Â Â  int i;

Â Â Â Â Â  for(i = 0; i &lt; 2; ++i)
printf(&quot;%s&quot;, message[i]);
Â Â Â Â Â  printf(&quot;n&quot;);
Â Â Â  }
</pre>
<p>Â </p>
<p>Seasoned professional<br />
Â Â Â  =====================<br />
Â </p>
<pre class="brush: c++">

#include &lt;iostream.h&gt;
Â Â Â  #include &lt;string.h&gt;

Â Â Â  class string
Â Â Â  {
Â Â Â  private:
Â Â Â Â Â  int size;
Â Â Â Â Â  char *ptr;

Â Â Â  public:
Â Â Â Â Â  string() : size(0), ptr(new char(&#039; &#039;)) {}

Â Â Â Â Â  string(const string &amp;amp;amp;amp;s) : size(s.size)
Â Â Â Â Â  {
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
Â Â Â Â Â  }

Â Â Â Â Â  ~string()
Â Â Â Â Â  {
delete [] ptr;
Â Â Â Â Â  }

Â Â Â Â Â  friend ostream &amp;amp;amp;amp;operator &lt;&lt;(ostream &amp;amp;amp;amp;, const string &amp;amp;amp;amp;);
Â Â Â Â Â  string &amp;amp;amp;amp;operator=(const char *);
Â Â Â  };

Â Â Â  ostream &amp;amp;amp;amp;operator&lt;&lt;(ostream &amp;amp;amp;amp;stream, const string &amp;amp;amp;amp;s)
Â Â Â  {
Â Â Â Â Â  return(stream &lt;&lt; s.ptr);
Â Â Â  }

Â Â Â  string &amp;amp;amp;amp;string::operator=(const char *chrs)
Â Â Â  {
Â Â Â Â Â  if (this != &amp;amp;amp;amp;chrs)
Â Â Â Â Â  {
delete [] ptr;
Â Â Â Â Â Â  size = strlen(chrs);
ptr = new char[size + 1];
strcpy(ptr, chrs);
Â Â Â Â Â  }
Â Â Â Â Â  return(*this);
Â Â Â  }

Â Â Â  int main()
Â Â Â  {
Â Â Â Â Â  string str;

Â Â Â Â Â  str = &quot;Hello World&quot;;
Â Â Â Â Â  cout &lt;&lt; str &lt;&lt; endl;

Â Â Â Â Â  return(0);
Â Â Â  }

Â </pre>
<p>Â </p>
<p>Â  Master Programmer<br />
Â Â Â  =================</p>
<pre class="brush: c++">
[
Â Â Â  uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
Â Â Â  ]
Â Â Â  library LHello
Â Â Â  {
// bring in the master library
importlib(&quot;actimp.tlb&quot;);
importlib(&quot;actexp.tlb&quot;);

// bring in my interfaces
#include &quot;pshlo.idl&quot;

[
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(&lt;windows.h&gt;);
importheader(&lt;ole2.h&gt;);
importheader(&lt;except.hxx&gt;);
importheader(&quot;pshlo.h&quot;);
importheader(&quot;shlo.hxx&quot;);
importheader(&quot;mycls.hxx&quot;);

// needed typelibs
importlib(&quot;actimp.tlb&quot;);
importlib(&quot;actexp.tlb&quot;);
importlib(&quot;thlo.tlb&quot;);

[
uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
aggregatable
]
coclass CHello
Â Â Â Â  {
Â Â Â Â  cotype THello;
Â Â Â Â  };
Â Â Â  };

Â Â Â  #include &quot;ipfix.hxx&quot;

Â Â Â  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 &lt;windows.h&gt;
Â Â Â  #include &lt;ole2.h&gt;
Â Â Â  #include &lt;stdio.h&gt;
Â Â Â  #include &lt;stdlib.h&gt;
Â Â Â  #include &quot;thlo.h&quot;
Â Â Â  #include &quot;pshlo.h&quot;
Â Â Â  #include &quot;shlo.hxx&quot;
Â Â Â  #include &quot;mycls.hxx&quot;

Â Â Â  int CHello::cObjRef = 0;

Â Â Â  CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
Â Â Â  {
cObjRef++;
return;
Â Â Â  }

Â Â Â  HRESULTÂ  __stdcallÂ  CHello::PrintSz(LPWSTR pwszString)
Â Â Â  {
printf(&quot;%wsn&quot;, 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 &lt;windows.h&gt;
Â Â Â  #include &lt;ole2.h&gt;
Â Â Â  #include &quot;pshlo.h&quot;
Â Â Â  #include &quot;shlo.hxx&quot;
Â Â Â  #include &quot;mycls.hxx&quot;

Â Â Â  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, &amp;amp;amp;amp;dwRegistration);

Â Â Â  // wait on an event to stop
Â Â Â  WaitForSingleObject(hEvent, INFINITE);

Â Â Â  // revoke and release the class object
Â Â Â  CoRevokeClassObject(dwRegistration);
Â Â Â  ulRef = pCF-&gt;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 &lt;windows.h&gt;
Â Â Â  #include &lt;ole2.h&gt;
Â Â Â  #include &lt;stdlib.h&gt;
Â Â Â  #include &lt;string.h&gt;
Â Â Â  #include &lt;stdio.h&gt;
Â Â Â  #include &quot;pshlo.h&quot;
Â Â Â  #include &quot;shlo.hxx&quot;
Â Â Â  #include &quot;clsid.h&quot;

Â Â Â  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] = &#039; &#039;;
Â Â Â  wcsT[0] = &#039; &#039;;
Â Â Â  if( argcÂ  1) {
mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
wcsupr(wcsPath);
}
Â Â Â  else {
fprintf(stderr, &quot;Object path must be specifiedn&quot;);
return(1);
}

Â Â Â  // get print string
Â Â Â  if(argcÂ  2)
mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
Â Â Â  else
wcscpy(wcsT, L&quot;Hello World&quot;);

Â Â Â  printf(&quot;Linking to object %wsn&quot;, wcsPath);
Â Â Â  printf(&quot;Text String %wsn&quot;, wcsT);

Â Â Â  // Initialize the OLE libraries
Â Â Â  hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);

Â Â Â  if(SUCCEEDED(hRslt)) {

hRslt = CreateFileMoniker(wcsPath, &amp;amp;amp;amp;pmk);
if(SUCCEEDED(hRslt))
Â Â Â Â  hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&amp;amp;amp;amp;pHello);

if(SUCCEEDED(hRslt)) {

Â Â Â Â  // print a string out
Â Â Â Â  pHello-&gt;PrintSz(wcsT);

Â Â Â Â  Sleep(2000);
Â Â Â Â  ulCnt = pHello-&gt;Release();
Â Â Â Â  }
else
Â Â Â Â  printf(&quot;Failure to connect, status: %lx&quot;, hRslt);

// Tell OLE we are going away.
CoUninitialize();
}

Â Â Â  return(0);
Â Â Â  }

Â 
</pre>
<p>Â </p>
<p>Â Apprentice Hacker<br />
Â Â Â  ===================</p>
<pre class="brush: perl">

Â #!/usr/local/bin/perl
Â Â Â  $msg=&quot;Hello, world.n&quot;;
Â Â Â  if ($#ARGV &gt;= 0) {
Â Â Â Â Â  while(defined($arg=shift(@ARGV))) {
$outfilename = $arg;
open(FILE, &quot;&gt;&quot; . $outfilename) || die &quot;Can&#039;t write $arg: $!n&quot;;
print (FILE $msg);
close(FILE) || die &quot;Can&#039;t close $arg: $!n&quot;;
Â Â Â Â Â  }
Â Â Â  } else {
Â Â Â Â Â  print ($msg);
Â Â Â  }
Â Â Â  1;
</pre>
<p>Â </p>
<p>Â Â Â  Experienced Hacker<br />
Â Â Â  ===================</p>
<pre class="brush: c++">

Â #include &lt;stdio.h&gt;
Â Â Â  #define S &quot;Hello, Worldn&quot;
Â Â Â  main(){exit(printf(S) == strlen(S) ? 0 : 1);}
Â 
</pre>
<p>Â </p>
<p>Â  Seasoned Hacker<br />
Â Â Â  ===================</p>
<pre class="brush: shell">

Â % cc -o a.out ~/src/misc/hw/hw.c
Â Â Â  % a.out
</pre>
<p>Â </p>
<p>Guru Hacker<br />
Â Â Â  ===================</p>
<pre class="brush: shell">

Â  % cat
Â Â Â  Hello, world.
Â Â Â  ^D
</pre>
<p>Â </p>
<p>Â  New Manager<br />
Â Â Â  ===================</p>
<pre class="brush: shell">

Â Â Â  10 PRINT &quot;HELLO WORLD&quot;
Â Â Â  20 END
Â 
</pre>
<p>Â </p>
<p>Â Â Â  Middle Manager<br />
Â Â Â  ===================</p>
<pre class="brush: shell">

Â Â mail -s &quot;Hello, world.&quot; bob@b12
Â Â Â  Bob, could you please write me a program that prints &quot;Hello, world.&quot;?
Â Â Â  I need it by tomorrow.
Â Â Â  ^D
</pre>
<p>Â </p>
<p>Â </p>
<p>Â Â Â  Senior Manager<br />
Â Â Â  ===================</p>
<pre class="brush: shell">

% zmail jim
Â Â Â  I need a &quot;Hello, world.&quot; program by this afternoon.
</pre>
<p>Â </p>
<p>Â </p>
<p>Chief Executive<br />
Â Â Â  ===================</p>
<pre class="brush: shell">

Â Â % letter
Â Â Â  letter: Command not found.
Â Â Â  % mail
Â Â Â  To: ^X ^F ^C
Â Â Â  % help mail
Â Â Â  help: Command not found.

Â Â Â  % damn!
Â Â Â  !: Event unrecognized
Â Â Â  % logout
</pre>
<p><a href="http://www.infiltec.com/j-h-wrld.htm" target="_blank">via</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.c0re.cc/2009/07/source-code/c-sharp/programas-hola-mundo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
