Question
Hi, I have a question regarding to format the console document. The required formatting is attached as JPEG file down below. The problem that I
Hi, I have a question regarding to format the console document. The required formatting is attached as JPEG file down below. The problem that I am facing with my output document is when I output I get :
RECTANGLE: length = 14.50 width= 4.65 area = 67.43 perimeter = 38.30 (HERE the rectangle should output length = 14.5 (EXACT SAME IN THE INPUT FILE) and the rest of the variables area and perimter should output set precision 2. I am not sure on how to setprecision only for specific variables becuase when I used set precision it set the precision for all the output items. However, I need the same exact value given in input file and for the length, width and set precision for area and perimeter
The sample coding that I have is:
int main()
{
.............................................
..........................................
//Formatting to two decimal points
cout.setf(ios::fixed);
cout.precision(2);
fout.setf(ios::fixed);
fout.precision(2);
----
...........
...............
}
void outputRectangleCalculation(ostream& out, const Rectangle *r) {
double area, perimeter;
area = s->length * s->length;
perimeter = 4.0 *s->length;
out length
}
E Handout3-2.pd LT X point%20notes/Handout3-2.pdf LAB ASSIGNMENT 2: SHAPES V.2 o Sample output console screen: DIMENSIONS invalid object CANDY invalid object SPHERE invalid object SQUARE side-14.5 area-210.25 perimeter-58.00 SQUARE side-0 area-0.00 perimeter-0.00 RECTANGLE length-14.5 width 4.65 area-67.43 perimeter 38.30 CIRCLE radius-14.5 area-660.52 perimeter- 91.11 BOX length 0 width- 2 height- 9 surface area 36.00 volume 0.00 CUBE side-13 surface area 1014.00 volume 2197.00 BOx length-1 width- 2 height- 3 surface area-22.00 volume 6.00 CYLINDER radius-2.3 height-4 surface area-91.04 volume-66.48 CYLINDER radius-1.23 height-0 surface area 9.51 volume-0.00 CYLINDER radius-50 height-1.23 surface area-16094.37 volume 9660.39 TRIANGLE side-1.2 area-0.62 perimeter-3.60 PRISM side-2.2 height-5 surface area 37.19 volume 10.48 [Finished in 5.4s] 11:25 PM Type here to search 9/8/2018Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started