Hello world with Literate Programming

2018/09/04

Hello world

This is a demo for pyweb

First, we have to define the program, let call it hello.cpp:

hello.cpp (1) =

→header files for program (2)
int main(int argc, const char* [] argv) {
    →print the message (3)
}

hello.cpp (1).

Header Files

Basically, we only need a header file which handles the output of the message, namely std::cout:

header files for program (2) =

#include <iostream>
using namespace std;

header files for program (2). Used by: hello.cpp (1)

Messages

To print the message Hello world, we simply put the output to the argument of std::cout:

print the message (3) =

cout << "Hello world" << endl;

print the message (3). Used by: hello.cpp (1)

It is done.