Question: I currently writing a C++ program that calculates area, perimeter, surface area, and volume of common 2D and 3D shapes. Then, the program outputs the
I currently writing a C++ program that calculates area, perimeter, surface area, and volume of common 2D and 3D shapes. Then, the program outputs the results on the console and in a separate text file. The program takes input from a text file called Shapes.input.txt.
Input file:
SQUARE 14.5 344
SQUARE
RECTANGLE 14.5 4.65
DIMENSIONS
CIRCLE 14.5
BOX x 2 9
CUBE 13
BOX 1 2 3
CYLINDER 2.3 4 56
CANDY
SPHERE 2.4
CYLINDER 1.23
CYLINDER 50 1.23
TRIANGLE 1.2 3.2
PRISM 2.199 5
EOF
I already have the completed program with the desired output but it required to have a parsing function that I had trouble figuring out how to implement. Any help I get will be well appreciated.
Parsing function required to be used in the program:
Expected Output:
My Code:
#include #include #include #include