Tuesday 27 November 2012

Hello World - C++

As people might know, I got pretty good at programming ten years back.

For whatever reasons I burnt out, and it has now been a long time since I have tried to code at all. I used to be pretty good at it and it is shocking how bad you can become if you don't practice.

So I wrote my first piece of code that works:


#include 
using namespace std;
const string cstStrMyName = "Ray";

int main()
{
    string a = "";
    cout << "Hello world! What is your name?" << endl;
    cin >> a;
    if (a != cstStrMyName)
        {cout << "hello " << a;}
    else
        {cout << "hello boss";};
    return 0;
}

Lots of syntax errors and silly mistypes but I have run it through the compiler and it works OKish.

Hope this will be fun ;)

No comments:

Post a Comment