Post Top Ad
Saturday, 23 July 2022
Calculate Area of Irregular Polygon with C++
About program
Use C++ to calculate area using shoelace formula.
Usage
To calculate area you need to change the variable number_of_polygon to the number of polygon your shape has. And change the coordinates array to the coordinate of each vertices of your shape. You need to list it in counter-clockwise position, and don't forget to add the first vertex to the back of the array to create a loop.
Example and output
Tuesday, 12 July 2022
Thursday, 30 June 2022
Use program to calculate area under curve with trapezoidal rule
Exercise
Use program to calculate area under curve with trapezoidal rule.
Here is the data.
The program in C++
First it read the data from the CSV file. Then it put the data into arrays. After that the program calculate trapezoidal area using for-loop. Finally, it output the result. NOTE: You must convert the excel file to csv file and remove the header and store it in the same directory in order to make the program work.
The output
Tuesday, 28 June 2022
Riemann Sum Program
Exercise
Using C++ to calculate Riemann Sums
This program creates a CSV file containing numbers of subintervals(n), left Riemann sum(L_n), right Riemann sum(R_n), and midpoint Riemann sum. Using for-loop to do the summation.
Result
Google SheetsThursday, 16 June 2022
Post Top Ad
Author Details
អ៊ឹង គួងម៉េង