top of page

C++ Introduction

Task 1

This is a simple code that assigns two float variables, adds them together in another float variable and outputs the result.

AnnotatedCode.png

This was a good introduction to how C++ differs from Python (the language I am more familiar with). Simple concepts like assigning and outputting variables were easy enough to understand. A difference I noticed from Python is that the data type (integer, float etc) must be stated before a variable can be assigned.

Task 2

Screenshot (5).png

This task was an introduction to functions. This was a concept I was quite familiar with from Python, but it was quite difficult as it has a lot of differences. Functions have to be declared before they can be defined. The data type rule applies here too. 

Screenshot (7).png

This is a slightly different version of the functions code. This time, the functions have values put into them when called, rather than putting the value into the body of the function. 

bottom of page