Directions: For this lab you will implement the functionality described below. You will do this in one .cpp that will prompt the user with the following format. Ensure that all prompts are preceded by the number for the problem and the word
#1 Prompt:
#1 Output:
#2 Prompt:
#2 Output:
.#1: Write a program that prompts the user to input 2 numbers. Output the product of these two numbers.
#2: Calculate the perimeter of a rectangle. Prompt the user to input the height and width of the rectangle.
#3: Calculate the circumference of a circle . Have the user input the radius of the circle. Assume pi = 3.141593, use a named constant to store this value.
The skeleton code is located under

#include #include using namespace std; int main() // Set the prompts to an appropriate value const string
cout << #2 Prompt: << prompt 2 << endl; //========== Your code goes here for prompt cout << #2 Output: << output2 << en

Respuesta :

Answer:

#include<iostream>

#include<string>

using namespace std;

int main()

{

//First program begins here

cout<<"Enter any two numbers: "<<endl;

float num1, num2;

cin>>num1>>num2;

cout<<"The product of the two numbers is: "<<num1 * num2<<endl<<'n';

//First Program ends here

 

//Second program begins here

cout<<"Enter the length and width of the rectangle: "<<endl;

float length, width;

cin>>length>>width;

cout<<"The perimeter of the rectangle is: "<<2 * (length + width)<<endl<<'n';

//Second Program ends here

 

//Third program begins here

cout<<"Enter the radius of the circle: "<<endl;

float radius;

cin>>radius;

const float pi = 3.141593;

cout<<"The circumference of the circle is: "<<2 * pi * radius<<endl<<'n';

//Third Program ends here  

return 0;

}

Explanation:

See Attachment where I used comments to explain each line

Lines that begin with // are comments

Ver imagen MrRoyal