week 4
|
I have been terrible at posting in this blog, so I am some weeks behind with my blog right now. This post is about the Kelvin/Fahrenheit/Celsius converter I did during week 3. I did write a fully functional code but realized that I just used ordinary functions, when the assignment was to create a class. I had some problems understanding classes and splitting code into header and cpp files before, but completing this assignment greatly helped me understand how this worked. The assignment weren’t really that hard, but I have found that while I sometimes can understand the code the teacher shows us during the lectures it still can be a challenge to use that knowledge. Here is the code I wrote in my header file: #pragma once class TemperatureConverter /*int choose(int);*/ float Farenheit_Celsius(float);
And just an example of how I used it: cpp: float TemperatureConverter::Farenheit_Celsius(float y ) } main: if (choose == 1)
|