Question: When I use an online c++ compiler, my code runs fin (without error) but ouputs 0.0 as my area instead of the acutal mathematical answer,,

When I use an online c++ compiler, my code runs fin (without error) but ouputs 0.0 as my area instead of the acutal mathematical answer,, what am I doing wrong?

C++ code being used:

#include #include using namespace std;

double const PI = 3.141592; void getDataa(double base, double height); void getData(double radiusa, double radiusb); void printData(double rec_area, double elli_area);

int main() { double base, height, radiusa, radiusb, rec_area, elli_area;

cout << "For the rectangle" << endl;

getDataa(base, height);

cout << "For the ellipse" << endl;

getData(radiusa, radiusb);

rec_area = base * height; elli_area = PI * radiusa * radiusa;

printData(rec_area, elli_area);

return 0; }

void getDataa(double base, double height) { cout << "Please enter two lengths " << endl; cin >> base; cin >> height; }

void getData(double radiusa, double radiusb) { cout << "Please enter two lenghts " << endl; cin >> radiusa; cin >> radiusb; }

void printData(double rec_area, double elli_area) { cout << "The area of the rectangle is "; cout << fixed << setprecision(1) << rec_area << endl; cout << "The area of the ellipse is "; cout << fixed << setprecision(1) << elli_area << endl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!