Lesson 1: A First Program

In this lesson, we closely analyse the program I copied and pasted in last time. I aim to explain how each element works – at a basic level at least – and why we use it. To finish up, I add a few extra lines to consolidate our new knowledge and introduce one or two additional features.

If you want to share your opinions, suggestions or corrections, you can comment on the video on YouTube or comment on the page here.

Source Code

The source code featured in this video was as follows:

#include <iostream>

int main()
{
    // write output to the console
    std::cout << "string literal here";
    std::cout << std::endl;
    std::cout << "Because we're all tired of 'Hello World!'" << std::endl;

    // write some more output
    std::cout << "consectetuer adipiscing elit." << std::endl;
    std::cout << std::endl;
    std::cout << 45 << ", " << 3.14 << "." << std::endl;
    std::cout << 45 << "45" << std::endl;
    std::cout << "this is a string literal" << '!' << std::endl;

    return 0;
}
  1. No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 73 other followers

%d bloggers like this: