Skip to Main Content

Centria Guide for Thesis and Academic Writing

Codes

If a code used in the text is below 15-20 lines, it is included in the text using indentation. If it is longer, it is included in the appendices. In the code section of the text the font is changed to courier new roman. The line spacing is 1.

In the example below, the code is used inside the text and the code is presented in a series of numbers for codes only, used just as the numbering of pictures.

Example:

When starting the C++ program, the first function to be called is the main() function. The first line of the main() function, in this case int i = 0; is the first line to be executed and consequently the execution of the program ends with the line return 0. The code is presented as follows:

 

int main()

{

          int i = 0;

          cout << ”i:n arvo on:” << i << endl;

          return 0;

}

Code 1. main-method in C++ program.

 

The realization of the main() function, such as (Code 1.) presented above, is a mandatory part of every C++- program.