Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1: This program will compute the volume of a cylinder. Write a function, area, that will compute the area of the base of a cylinder,

Q1: This program will compute the volume of a cylinder. Write a function, area, that will compute the area of the base of a cylinder, and return the value of area to the main program. The main program will then compute the volume using the value of area, and the height of the cylinder, h.

#include

#include

#include

using namespace std;

//function prototype

_____________________________________________________

int main()

{

double volume;

double h,r;

cout<<"Enter the height of the cylinder: "<

cin>>h;

cout<<"Enter the radius of the base of the cylinder: "<

cin>>r;

cout<<"The area of the base is: "______________________________

cout<<"The height of the cylinder is: "<

volume=area(r)*h;

cout<<"The volume of the cylinder is: "<

return 0;

}

//function body

______________________________________________________

______________________________________________________

_______________________________________________________

Q2: This highlighted statement in the program has been modified in two different ways: A) and B). Now you need to check the output and answer the following questions.

// function prototype

void show(int [], int);

int main()

{

const int arraysize=5;

int numbers[arraysize]={3,6,12,7,5};

show(numbers,arraysize);

// (A) show(numbers,arraysize+3);

// (B) show(numbers,arraysize-1);

return 0;}

//function body

void show(int nums[], int size)

{

for (int index=0;index

cout<

}

Q1: What is the output of the original problem?

Q2: What is the output if modification (A) has been made?

Q3: What is the output if modification (B) has been made?

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_2

Step: 3

blur-text-image_3

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

LO3 Describe the purpose of equity legislation.

Answered: 1 week ago

Question

LO4 Describe the purpose of privacy legislation.

Answered: 1 week ago