• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest Jan 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //Andrew Lohr
2. //Assignment 1
3. //Sept 20
4.
5.
6. #include <iostream>
7. #include <cmath>
8.
9. using namespace std;
10.
11. int main()
12. {
13.     const double PI = 3.141592;
14.     double a = 10.3, b = 20.5, radians = (PI/180);
15.     int c = 4, d = 30, e = 45, f = 60;
16.
17.
18.     cout<<"The ceil of 10.3 is: " << ceil(a) // Rounds the number up
19.         <<"\nThe floor of 10.3 is: "<< floor(a) // Rounds the number down
20.         <<"\ne raised to 4 is: "<< exp(c) // raises e^ x
21.         <<"\nThe log of 4 is: "<< log(4) // Finds the log of a number
22.         <<"\nThe log base 10 of 20.5 is: "<< log10(b) // Finds the log base10 of a number
23.         <<"\n10.3 raised to the power 5 is: "<< pow(a , 5.0) // Gives the answer of a number raised to the power of another number
24.         <<"\nThe square root of 20.5 is: " << sqrt(b) // Gives the aquare root of a number
25.         <<"\n\nThe sin of 30 is " <<sin((d*(radians))) <<", sin of 45 is: "<<sin((e*(radians)))<<", sin of 60 is: "<<sin((f*(radians)))
26.         <<"\nThe cos of 30 is " <<cos((d*(radians))) <<", cos of 45 is: "<<cos((e*(radians)))<<", cos of 60 is: "<<cos((f*(radians)))
27.         <<"\nThe tan of 30 is " <<tan((d*(radians))) <<", tan of 45 is: "<<tan((e*(radians)))<<", tan of 60 is: "<<tan((f*(radians)));
28.
29.     system("pause>nul");
30.     return 0;
31. }
32.
33. The ceil of 10.3 is: 11
34. The floor of 10.3 is: 10
35. e raised to 4 is: 54.5982
36. The log of 4 is: 1.38629
37. The log base 10 of 20.5 is: 1.31175
38. 10.3 raised to the power 5 is: 115927
39. The square root of 20.5 is: 4.52769
40.
41. The sin of 30 is 0.5, sin of 45 is: 0.707107, sin of 60 is: 0.866025
42. The cos of 30 is 0.866025, cos of 45 is: 0.707107, cos of 60 is: 0.5
43. The tan of 30 is 0.57735, tan of 45 is: 1, tan of 60 is: 1.73205
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top