Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In function ShowArea(), if areaPointer is null, print areaPointer is null.. Otherwise, print the value in the variable pointed to by areaPointer. End with a

In function ShowArea(), if areaPointer is null, print "areaPointer is null.". Otherwise, print the value in the variable pointed to by areaPointer. End with a newline. Ex: If the input is Y 3.0, then the output is: 3.0

code-------

#include #include using namespace std;

void ShowArea(double* areaPointer) {

/* Your code goes here */ if(areaPointer != nullptr) { cout << *areaPointer << endl; } else { (areaPointer == nullptr); cout << "areaPointer is null." << endl; } }

int main() { double area; double* areaPointer; char action; area = 0.0; cin >> action; cin >> area;

if (action == 'Y') { areaPointer = &area; } else { areaPointer = nullptr; } ShowArea(areaPointer);

return 0; }

-------

if input y 3.0 or anything .0, output drops the .0 Please help me figure out what I am missing.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

More Books

Students also viewed these Databases questions

Question

Ensure continued excellence in people management.

Answered: 1 week ago

Question

Enhance the international team by recruiting the best people.

Answered: 1 week ago