Hello World in the C++ standard ISO/IEC 14882:2011(E)

In a previous post, I talked about the “Hello World” example in the C# standard.  The C++ mention of the Hello World is brief and not really a code example, to demonstrate the Function and specifically the  parameter-declaration-clause from page 192 (page number at the bottom of the page, not the pdf defined page) or paragraph 8.3.5:

printf("hello world");

printf("a=%d b=%d", a, b);

But I wrote a little example below that works if you use the Visual Studio 2013 C++ Console Project:

#include <stdio.h>
#include "stdafx.h"

int main()
{
    int a = 42, b=56;
    //int b = 56;
    printf("hello world \n");
    printf("a=%d b=%d \n", a, b);
    return 0;
}

I also checked the C ISO/IEC 9899:2011, but there is no “Hello World” example, but there is the “Eh?” example and I will discuss that in my next blog.

At this point you might be thinking has Surf4Fun lost his mind?  And the answer would be yes.   Frankly there wasn’t much to lose.

But the point is this: The C# specification is actually not a bad read, but neither are the other specifications like C++ or C or even FORTRAN.  If you work for a corporation or attend a school it is likely you can get a copy of the C++ and C specification through your company. 

Bear in mind that the C# spec is free whether you use the ECMA or ISO standard.  C++, C cost $150 or so, but usually most technology corporations or colleges have a subscription.