1. Write a C++ program to calculate the size of a building lot in acres. Assume
ID: 3537750 • Letter: 1
Question
1. Write a C++ program to calculate the size of a building lot in acres. Assume the lot is rectangular. Interactively input the width and length in feet. Compute the size of the lot in acres.
Must show the following test case after compile and run,
Note: google calculator says this is 2.75 acres
2.Write a C++ program to calculate the volume of a cylinder. Interactively input the diameter and the height in inches. Display the computed volume in ounces (US fluid ounces).
The formula for the cylinder volume is,
Must show the following test case after compile and run,
Note: these are approximately the dimensions of a standard 12 ounce can.
Explanation / Answer
1)
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdlib>
using namespace std;
int main()
{
int wd,ln;
float ac,ar;
cout<<"Enter Width(in feet) of Lot:";
cin>>wd;
cout<<" Enter Lenght(in feet) of Lot:";
cin>>ln;
ar=wd*ln;
ac=ar/43560;
cout<<" Size of Lot in Acres:"<<ac;
system("PAUSE");
return 0;
}
OUTPUT: http://ideone.com/JoNyHj
2)
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdlib>
using namespace std;
int main()
{
float dia,ht;
float res,vol,pi=3.14234;
cout<<"Enter Diameter(in inch) of Cylinder:";
cin>>dia;
cout<<" Enter Height(in inch) of Cylinder:";
cin>>ht;
vol=(ht*pi*dia*dia)/4;
res=vol*0.55411;
cout<<" Volume Of Cylinder in Ounces(Fluid, US):"<<res;
system("PAUSE");
return 0;
}
OUTPUT: http://ideone.com/GEjF7A
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.