
Centroid of Plane Object


The center of gravity (or centroid) of an elemental planar shape i has coordinates xii and area iA. For calculating the centerline of a cross section (ie, x, y) it is required to compute x, y from all elementary planar shapes that compose the cross section. Define a struct with a centroid name to manage elementary planar shapes that all belong to the same cross section. The members of the structure are the coordinates and the area, according to the above. All values are double.
The program should include functions for:
i. the input of the N (N = known) elemental shape data into a dataset (data_entry function). Use random numbers with 50 for the coordinates and 2000 for the area.
ii. (1 row for each elementary shape) (data_display function).
iii. finding the x, y of the cross section (a function named find_centroid), taking into account all the elements of the structure table.
The three functions will be called consecutively from main (). After calling the find_ centroid function, the program should display the values for x, y.