{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

unit 3 me 205

# unit 3 me 205 - if(fTh<=0 cout<<"Invalid radian...

This preview shows pages 1–3. Sign up to view the full content.

Sheet1 Page 1 { int R, C /*R-Radius of circle */ float perimeter /*Circumference of circle */ float area /*area of circle */ C = PI R = 5 Perimeter = 2.0 *C *R Area = C*R*R cout >> perimeter, area } #include <iostream> #define pi 3.14159 int main(void) { int iR, C float fP = 0.0 float fA = 0.0 cout <<" #include <iostream> using namespace std int main(void) { int iA=15 int iB=7 int iC=2 iA++ iB = iA%iB --iB cout << iA*iB/iC << endl cout << ((iB < iC) ? iA : iB) << endl cout << ++iA << endl return 0 } #include <iostream> #include <cmath>

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 #define pi 3.14159 using namespace std int main(void) { float f1 = 0.0 float f2 = 0.0 float fTh = 0.0 double dA = 0.0 cout <<"Please enter a value for the first side of the triangle."<< endl cin >> f1 if(f1<=0) { cout <<"Invalid side value, exiting. .."<<endl return 0 } cout <<"Now please enter a value for the second side of the triangle."<< endl cin >> f2 if(f2<=0) { cout <<"Invalid side value, exiting. .."<<endl return 0 } cout <<"Now please enter a valid angle value in radians."<< endl cin >> fTh
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if(fTh<=0) { cout <<"Invalid radian value, exiting. .."<<endl return 0 } if(fTh>=2*pi) { cout <<"Invalid radian value, exiting. .."<<endl return 0 } dA = (.5)*f1*f2*sin(fTh) cout <<"The area of your triangle is: " << dA << endl return 0 } Sheet1 Page 3 #include <iostream> #include <cmath> using namespace std int main(void) { float fA, fB, fC, fS, fArea = 0.0 cout<<"Please enter a value for the first side of the triangle."<<endl cin >> fA if(fA<=0) { cout<<"Invalid input, exiting. .."<<endl return 0 } cout <<"Please enter a value for the second side of the triangle."<<endl cin >> fB if(fB<=0) { cout<<"Invalid input, exiting. .."<<endl return 0 } cout <<"Please enter a value for the third side of the triangle."<<endl cin >> fC if(fC<=0) { cout<<"Invalid input, exiting. .."<<endl return 0 } fS = (fA+fB+fC)/2 fArea = sqrt(fS*(fS-fA)*(fS-fB)*(fS-fC)) cout <<"The area of the triangle is: " << fArea <<endl return 0 }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

unit 3 me 205 - if(fTh<=0 cout<<"Invalid radian...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online