Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.15 KB

literate.cpp.md

File metadata and controls

53 lines (35 loc) · 1.15 KB

C++ literate example

This is an example of C++ programming, in the style promoted by Knuth called literate programming. The text is encoded using Markdown.

More about literate programming:

The program

The simplest C++ program:

#include <iostream>
 
int main () {
    std::cout << "That's all Folks!" << std::endl;
}

Fancy, doensn't it?

How to evaluate?

Simply run this command in the Shell:

$ ./run-md literate.cpp.md 
>>> Running: literate.cpp.md
That's all Folks!

How to publish?

Install MarkDown processors:

MANAGER=yum
which dnf >/dev/null 2>&1 && MANAGER=dnf
which apt-get >/dev/null 2>&1 && MANAGER=apt-get
sudo $MANAGER -y install pandoc texlive

and execute make build in this directory! HTML and PDF output formats are generated. Check with any HTML browser and PDF viewer:

elinks literate.cpp.html
evince literate.cpp.pdf

That's all Folks!