1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
using namespace std ;
#include<iostream>
#include<cmath>
#include<fstream>
int main ()
{
double a,x,y,z,r,h,k,saoc,saorp,saocc,saos ;
int n,g,o,p,j,u;
ofstream dataout ("yenidata.txt") ;
cout<<"Please choose the number that refers to the shape that you want to calculate of surface area "<<endl;
cout<<"1-Cube"<<endl;
cout<<"2-Rectangular Prism"<<endl;
cout<<"3-Cylinder "<<endl;
cout<<"4-Sphere"<<endl;
cin>>n;
cout<<"which unit you will give the values and which unit you want result"<<endl;
cout<<"1-m2(given) - cm2(expected)"<<endl;
cout<<"2-cm2(given) - m2(expected)"<<endl;
cin>>u ;
if((n=1) && (u=1))
{
cout<<"Please enter a side lenght of the cube"<<endl;
cin>>a;
saoc=6*pow(a,2);
saoc=saoc*100 ;
cout<<"Surface Area of the Cube="<<saoc<<"cm2"<<endl;
}
if ( (n=1) && (u=2) )
{
cout<<"Please enter a side lenght of the cube"<<endl;
cin>>a;
saoc=6*pow(a,2);
saoc=saoc/100 ;
cout<<"Surface Area of the Cube="<<saoc<<"m2"<<endl;
}
if ((n=2) && (u=1))
{
cout<<"Please enter the sides of prism ( width,depth,heigth)"<<endl;
cin>>x>>y>>z;
saorp=2*(x*y+x*z+y*z);
saorp=saorp*100 ;
cout<<"Surface Area of the Rectangular Prism="<<saorp<<"cm2"<<endl;
}
if ((n=2) && (u=2))
{
cout<<"Please enter the sides of prism ( width,depth,heigth)"<<endl;
cin>>x>>y>>z;
saorp=2*(x*y+x*z+y*z);
saorp=saorp/100 ;
cout<<"Surface Area of the Rectangular Prism="<<saorp<<"m2"<<endl;
}
if((n=3) & (u=1))
{
cout<<"Please enter the radius and height of the cylinder"<<endl;
cin>>r>>h;
saocc=2*3.1415*pow(r,2)+2*3.1415*h ;
saocc=saorp*100 ;
cout<<"Surface Area of the Cylinder="<<saorp<<"cm2"<<endl;
}
if ((n=3) & (u=2))
{
cout<<"Please enter the radius and height of the cylinder"<<endl;
cin>>r>>h;
saocc=2*3.1415*pow(r,2)+2*3.1415*h ;
saocc=saorp/100 ;
cout<<"Surface Area of the Cylinder="<<saorp<<"m2"<<endl;
}
if ((n=4) & (u=1) )
{
cout<<"Please enter radius of the sphere"<<endl;
cin>>k;
saos=4*3.1415*pow(k,2) ;
saos=saos*100 ;
cout<<"Surface Area of the Cylinder="<<saorp<<"cm2"<<endl;
}
else
{
cout<<"Please enter radius of the sphere"<<endl;
cin>>k;
saos=4*3.1415*pow(k,2) ;
saos=saos/100 ;
cout<<"Surface Area of the Cylinder="<<saorp<<"m2"<<endl;
}
system ("pause");
return 0 ;
}
|