Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved 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,,

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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 Databases questions

Question

which is a characteristic of the price of preferred stock

Answered: 1 week ago

Question

How does the concept of hegemony relate to culture?

Answered: 1 week ago