Saturday, 15 February 2020

Chapter 10 // Exercise 7 - Principles & Practice Using C++

In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:

http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Chapter 10 // Exercise 7

Make a version of the calculator from Chapter 7 that accepts Roman Numerals rather than the usual Arabic ones, for example, XXI + CIV == CXXV.


When I first tried this I realised we needed a way to convert Roman Numeral to Ints so went back to the previous exercise and added a new function that does that. Then it became as simple as adding the class to the file and checking input for roman numerals. Once they are all added, they are then converted to an int, the calculations are done and then the resulting int is converted back to a Roman Numeral.

No comments:

Post a Comment