Write a C++ program to print an algorithm that calculates the volume of a rectan
ID: 3868722 • Letter: W
Question
Write a C++ program to print an algorithm that calculates the volume of a rectangular prism
EXAMPLE
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() //execution function for all the C++ programs
{
cout << "*********Assignment 1***************************************" << endl;
cout << "First Program - console output" <<endl;
cout << "Desiree , 8/18/2017" << endl;
cout << "practice consol output - Algorithm for calculating volume of rectanglualr prism" << endl;
cout << "get the length of the rectanglualr prism" << endl;
cout << "get " << endl;
cout << "get " << endl;
cout << "find the volume of the rectanglualr prism" << endl;
cout << "volume = " << endl;
cout << "print (output) the volume of the rectanglular prism on the console" << endl;
cout << "*******************************************************************************" << endl;
system("pause");
return 0;
}
Explanation / Answer
#include<iostream.h>
using namespace std; //using this so that we dont have to write std everytime in program;//
int main()
{
int l,b,h,v;
cout<<"we are here to find the volume of a rectangular prism "<<endl;
cout<<"enter the dimensions of the prism of which you want to find the volume"<<endl;
cout<<"length"<<endl;
cin>>l;
cout<<"breadth"<<endl;
cin>>b;
cout<<"height"<<endl;
cin>>h;
v=l*b*h;
cout<<"volume of prism is"<<endl;
cout<<v;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.