Question
#include #include using namespace std; double width, height, radius,base,a,b,n; void enterwh() { cout < < Please enter number of width : ; cin >> width;
#include
double width, height, radius,base,a,b,n;
void enterwh() { cout << "Please enter number of width : "; cin >> width; cout << "Please enter number of height : "; cin >> height; } void enterw(){ cout << "Please enter number of width : "; cin >> width; } void enterbh(){ cout << "Please enter number of base : "; cin >> base; cout << "Please enter number of height : "; cin >> height; } void enterr() { cout << "Please enter the radius: "; cin >> radius; } void enterah(){ cout << "Please enter number of horizontal radius : "; cin >> a; cout << "Please enter number of height : "; cin >> height; } void enterahn(){ cout << "Please enter number of horizontal radius : "; cin >> a; cout << "Please enter number of height : "; cin >> height; cout << "Please enter number of n : "; cin >> n; } void enterab(){ cout << "Please enter number of horizontal radius : "; cin >> a; cout << "Please enter number of vertical radius : "; cin >> b; }
int main() { int n = 0; int t_element = 0; double x, y = 0, xA = 0, yA = 0, A = 0, sumxA = 0, sumyA = 0, sumA = 0, xf, yf, Area = -1, pi = 3.14159265359; cout << " Please enter number of element : "; cin >> n; for (int i = 1;i <= n;i++) { cout << " 1 - Triangle \t2 - Rectangle 3 - Square \t4 - Circle 5 - Quarter circular \t6 - Semicircular 7 - Parabolic \t8 - Semiparabolic 9 - Parabolic spandrel \t10 - General spandrel 11 - Quarter-elliptical 12 - Semielliptical" ; cout << " Please enter type of element : "; cin >> t_element; Area = -1; if (t_element == 1) { enterbh(); Area = (base * height) / 2; } else if (t_element == 2) { enterwh(); Area = height * width; } else if (t_element == 3) { enterw(); Area = width * width; } else if (t_element == 4) { enterr(); Area = pi * radius * radius; } else if (t_element == 5) { enterr(); Area = (pi * radius * radius) / 4; } else if (t_element == 6) { enterr(); Area = (pi * radius * radius) / 2; } else if (t_element == 7) { enterah(); Area = (4* a *height)/3; } else if (t_element == 8) { enterah(); Area = (2* a *height)/3; } else if (t_element == 9) { enterah(); Area = (a*height)/3; } else if (t_element == 10) { enterahn(); Area = (a*height)/(n+1); } else if (t_element == 11) { enterab(); Area = (pi * a * b)/4; } else if (t_element == 12) { enterab(); Area = (pi * a * b)/2; }
if(Area != -1) cout << " Area : " << Area; else { cout << " Element not found"; } } cout << " Please enter number of element : "; cin >> n; for (int i = 1;i <= n;i++) { cout << " Please enter value of x : "; cin >> x; cout << " Please enter value of y : "; cin >> y; cout << " Please enter value of A : "; cin >> A;
xA = x * A; cout << " xA is : " << xA; yA = y * A; cout << " yA is : " << yA;
sumxA = sumxA + xA; sumyA = sumyA + yA; sumA = sumA + A; }
cout << " Sum of xA is : " << sumxA; cout << " Sum of yA is : " << sumyA;
xf = sumxA / sumA; yf = sumyA / sumA;
cout << " x is : " << xf; cout << " y is : " << yf;
}
Please convert this code to a flowchart
thank you in advance
Step 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