Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ program please make sure don't use vectore or reursing Task 2: The file data.1:xt contains unknown number of records. Each record starts with a

c++ program please make sure don't use vectore or reursing

image text in transcribed
Task 2: The file "data.1:xt\" contains unknown number of records. Each record starts with a character '3' or 'c' which represents square and circle respectively. The next number represents length of the square or radius of the circle. For each record in the file, calculate the area of the figure and write it in their respective les; circle.txt or squaretxt. Also, for each shape, find the maximum, minimum, and average area and write this information at the end of each file along with the shape number. Provide a functionbased CH solution to it. In your program, you must I Use 1D dynamic arrays only {static arrays are not allowed] with initial size of 1. When full, they get expanded by the factor of 2. I Write a function which reads data.th into two arrays square and circle accordingly. I Write a function which calculates the area of each shape and store it in two arrays squareA and circle]! accordingly. I Write a function which finds the maximum area and the shape number which has the maximum area. I Write a function which finds the minimum area and the shape number which has the minimum area. I Write a function which finds the average area. I Write a function which writes all data related to a shape in its respective output file. You can use other user defined functions as well. Use appropriate number of parameters, their data type and return types for each function. datatxt circle.txt c,3 Area of circle 1 with radius 3 is 28.21\". c,'? Area of circle 2 with radius 7 is 153.94. 5,9 Area of circle 3 with radius 2 is 15.21. c,2.2 s,1 Maximum Area = 153.94 of circle 2 5,2 Minimum Area = 15.21 of circle 3 5,3 Average Area = 65.81 Area of square 1 with length 9 is 81. Area of square 2 with length 1 is 1. Area of square 3 with length 2 is 4. Area of square 4 with length 3 is 9. Maxjmmn Area Dllinjll'LUIl'L Area Average Area 81 of square 1 1 of square 2 23.75

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions