Question: Problem 3 ( 8 points ) The CWRU math department has discovered a new polyhedron! Unfortunately, they only know the number of edges, the number
Problem points
The CWRU math department has discovered a new polyhedron! Unfortunately, they only know
the number of edges, the number of vertices, and that each face is the same shape. They want
you to write a code that can determine how many faces it has. According to Euler's polyhedron
formula, if you are given the number of vertices and edges of any polyhedron you can
determine the number of faces it has. The relationship between these is as follows:
The data for the mystery object and other polyhedrons has been put in a file named
HWPolyhedrons.txt Read in the data using fscanf, skipping over the string data
without storing it but storing the vertex and edge data in vectors. We will address how to
properly store string data in the next lecture. Calculate the number of faces each polyhedron has
and store those in a new vector.
Next write the information, plus a statement about the number of faces that the mystery object
has to a new file called HWPolyFaces.txt Use fprintf statements. Instead of
printing the names of the objects, just give them a number, with the last object being the mystery
object. Your file format should look like the example on the next page, though your spacing may
be a little different.
Note that the alignment of the file will probably be a bit off, something like in the example
above, and this is OK Also note that you can use in a fprintf statement to put in a tab.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
