Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <limits>
- #include <cctype>
- #include <math.h>
- using /*HATS*/ namespace std;
- const double Z =
- 3.14159265358979;
- int k4Mxty4 = 20; double
- j( double jk ) { return
- jk * (Z/180.0);} double b(double h7){return h7*
- (180.0/Z);} double d5w(double n) {return (n < 0
- || fmod(n,1.0)!= 0.0)?-1:(n==1||n==0)?1:d5w(n-1)*n;}double oL3m(double g)
- {while(g<0.00){g+=360.0;}while (g > 360.0){g -= 360.0;}return g;}int r02(
- int n){return (n<0)?0:(n>20)?20:n;}double cYF54(double x, bool o
- = 1){double r = 1.0;double q;int i = 1;do{q = r;r += pow( -1.0,i)
- *(pow(x,i*2.0)/d5w(i*2.0));i++;if(o){cout<<setfill(' ') <<setw(
- k4Mxty4 + 3 ) << q << " | " << setfill( ' ' ) << setw( k4Mxty4
- +3)<<r<<" | Dif: "<<setfill(' ')<<setw(k4Mxty4+3) << (q- r)<<
- "\n";}}while(q != r);return r;}template< typename i> i win(){
- i x;cin>>x;while(cin.fail()){cin.clear();std::cin.ignore( /**lol*/
- numeric_limits<streamsize>::max(),'\n');cout<<"\nY"; cout <<"ou l"
- <<"ose. Try again: "; cin >> x;} return x;}int main(){char ill1i=
- 'y';double frog; do{cout<<"Angle: ";frog=j(oL3m(win<double>( )));
- cout<<"\n";cout << "Sigfigs: ";k4Mxty4 = r02(win<int> ());cout
- << "\n";cout<<setprecision(k4Mxty4)<<fixed;cout<<"co" <<"s("<<
- setprecision(2)<<fixed << b(frog)<<") = "<<setprecision(k4Mxty4)
- <<fixed<<cYF54(frog)<<"." <<"..\n\n";cout << "math.h cos() func"
- <<"tion output: " << setfill(' ') << setw(k4Mxty4+3)
- <<cos(frog)<<"\n"; cout << "Differen" <<"ce betwee"<<
- "n fu" <<"n" <<"ct" <<"ion"
- <<"s:" <<" "<< setfill( ' ') <<
- setw(k4Mxty4+3)<< cYF54(frog,0)-cos( frog)<<"\n\n";
- cout<<"Again y/n" <<"? ";ill1i=tolower (win<char>());
- cout << "\n";} while (ill1i == 'y');cout << "Press "<<
- "Enter"<<" to Exit.";cin.ignore();cin.get();return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement