Commit 0560aa3e authored by Kevin Höllring's avatar Kevin Höllring
Browse files

Extend the readme

parent fcf1aa65
# 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment