C++ Functions With Arguments Without Return Value
//Type of Functions
//Function with arguments and without return value.
#include<iostream>
using namespace std;
void POT(float,float,float,float);
void COC(float,float);
void VOC(float,float);
void VOCU(float,float,float,float);
void VOSP(float,float,float);
int main()
{
float s1,s2, s3,d;
cout<<"Enter Side 1 of triangle: ";
cin>>s1;
cout<<"Enter Side 2 of triangle: ";
cin>>s2;
cout<<"Enter Side 3 of triangle: ";
cin>>s3;
POT(s1,s2,s3,d);
cout<<"=====================================\n";
float r,a;
cout<<"Enter the diameter of the Circle: ";
cin>>r;
COC(r,a);
cout<<"=====================================\n";
float w,dd,g;
cout<<"Enter the Base of the Square Pyramid : ";
cin>>w;
cout<<"Enter the Height of the Square Pyramid : ";
cin>>dd;
VOSP(w,dd,g);
cout<<"=====================================\n";
float rr,aa;
cout<<"Enter the Edge of the cube: ";
cin>>rr;
VOC(rr,aa);
cout<<"=====================================\n";
float l,ww,h,aaa;
cout<<"Enter the Length of the Cuboid : ";
cin>>l;
cout<<"Enter the Breadth of the Cuboid: ";
cin>>ww;
cout<<"Enter the Height of the Cuboid: ";
cin>>h;
VOCU(l,ww,h,aaa);
}
void POT(float s1, float s2,float s3,float d)
{
d=s3+s2+s1;
cout<<"Perimeter of triangle :"<<d<<endl;
}
void COC(float r,float a)
{
a=r*3.14;
cout<<"Circumference of Circle :"<<a<<endl;
}
void VOC(float r,float a)
{
a=r*r*r;
cout<<"Volume of the cube is :"<<a<<endl;
}
void VOCU(float l,float h,float w,float a)
{
a=l*w*h;
cout<<"Volume of the Cuboid is :"<<a<<endl;
}
void VOSP(float rr,float ww,float gg)
{
gg=(0.3*ww*ww)*rr;
cout<<"Volume of the Square Pyramid is :"<<gg<<endl;
}
Comments
Post a Comment