From 0560aa3ebcfb8fdc724d7050cbf9c248781c4e58 Mon Sep 17 00:00:00 2001 From: Reshief Luminon <reshief@gmx.net> Date: Tue, 22 Oct 2019 04:33:36 +0200 Subject: [PATCH] Extend the readme --- README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5390b2..3122560 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ -# cpp_introduction +# C++ introduction -Templates for the C++ introduction \ No newline at end of file +This repository contains multiple templates for the C++ introduction in the module CP1. + +In the "sample_*.cpp"-files you will find examples of C++ code detailing different aspects of the language. + +In the "task_*.cpp"-files you will find problem statements for you to complete on your own. +Read the problem statement detailed by the comment in the file and implement a program that behaves as described. + +## How to compile a program + +C++ is a human-readable language. +In order to be executable by a computer, the program has to be translated into machine code. + +You can use the command + +'g++ <source_code_file> -o <name_of_output_program> -std=c++11 -Wall -Werr' + +This tells the compiler (g++) where to find the source code and how to name the resulting program. +In case you omit the name of the output program the result will most likely be an executable file called "a.out". +The flags at the end of the command tell the compiler which version of C++ to use (C++ 2011) and to trigger all warnings your code might produce and elevate them to errors. +It is generally a good practice to use these last two flags. +If your code does compile without these two options but does not compile with them, chances are high that there is still a programming error in your program. + +A sample invocation of the command: + +'g++ src/sample_4.cpp -o sample_4 -std=c++11 -Wall -Werr' + +And the sample program can then be run by calling + +'./sample_4' + +in the console. \ No newline at end of file -- GitLab