Sunday, May 2, 2010

Starting down the path.

I have been over the last few days looking at all the options available to me. The most important thing to me right now is usefulness. I want to learn a language that I can use often.

Being in a Linux environment I looked at the most common languages used for programs and by far it was C. Python was also used frequently but not anywhere near as much. So it will be C that is my first path.

My son has decided to come along and learn with me though he wants to learn C++. It will be fun to see what lay ahead of us on this journey. Our first steps will be searching for good reference material and development software.

We have found a few good sites for tutorials and have chosen this one as our first.

For me:
Lesson 1: The basics of C

And for him:
C++ Language Tutorial

My first lesson concentrated on learning this simple program:


// Hello world program

#include

int main ()
{
printf (“Hello, world!\n”);
return 0;
}


My son's looked like this:

// My first program

#include

int main ()
{
std::cout << “Hello, world! I am alive!“;
return 0;
}


As you can see there are differences between C and C++ the first being how the includes are handled and the inclusion of the namespace std in a limited way. He could have declared using namespace std; in the header but then it would bring in the standard library globally which in some cases can cause trouble so we are avoiding that by using the std::cout.

I know it's not all that impressive yet but we have both learned a lot the last couple days.

0 comments:

Post a Comment