Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Andrew Lohr
- //Assignment 1
- //Sept 20
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- const double PI = 3.141592;
- double a = 10.3, b = 20.5, radians = (PI/180);
- int c = 4, d = 30, e = 45, f = 60;
- cout<<"The ceil of 10.3 is: " << ceil(a) // Rounds the number up
- <<"\nThe floor of 10.3 is: "<< floor(a) // Rounds the number down
- <<"\ne raised to 4 is: "<< exp(c) // raises e^ x
- <<"\nThe log of 4 is: "<< log(4) // Finds the log of a number
- <<"\nThe log base 10 of 20.5 is: "<< log10(b) // Finds the log base10 of a number
- <<"\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
- <<"\nThe square root of 20.5 is: " << sqrt(b) // Gives the aquare root of a number
- <<"\n\nThe sin of 30 is " <<sin((d*(radians))) <<", sin of 45 is: "<<sin((e*(radians)))<<", sin of 60 is: "<<sin((f*(radians)))
- <<"\nThe cos of 30 is " <<cos((d*(radians))) <<", cos of 45 is: "<<cos((e*(radians)))<<", cos of 60 is: "<<cos((f*(radians)))
- <<"\nThe tan of 30 is " <<tan((d*(radians))) <<", tan of 45 is: "<<tan((e*(radians)))<<", tan of 60 is: "<<tan((f*(radians)));
- system("pause>nul");
- return 0;
- }
- The ceil of 10.3 is: 11
- The floor of 10.3 is: 10
- e raised to 4 is: 54.5982
- The log of 4 is: 1.38629
- The log base 10 of 20.5 is: 1.31175
- 10.3 raised to the power 5 is: 115927
- The square root of 20.5 is: 4.52769
- The sin of 30 is 0.5, sin of 45 is: 0.707107, sin of 60 is: 0.866025
- The cos of 30 is 0.866025, cos of 45 is: 0.707107, cos of 60 is: 0.5
- The tan of 30 is 0.57735, tan of 45 is: 1, tan of 60 is: 1.73205
Add Comment
Please, Sign In to add comment