Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h> //header file for math functions
- #include<iomanip> //header file for manipulators
- #define PI 3.14159265 //defining a constant called pi
- using namespace std;
- class mySine {
- public:
- float x,y;
- float sine(float x){
- return sin(x*PI/180);
- }
- };
- int main () {
- mySine point1;
- point1.x = 0;
- point1.y = point1.sine(point1.x);
- mySine point2;
- point2.x = 10;
- point2.y = point2.sine(point2.x);
- mySine point3;
- point3.x = 20;
- point3.y = point3.sine(point3.x);
- mySine point4;
- point4.x = 30;
- point4.y = point4.sine(point4.x);
- mySine point5;
- point5.x = 50;
- point5.y = point5.sine(point5.x);
- mySine point6;
- point6.x = 60;
- point6.y = point6.sine(point6.x);
- mySine point7;
- point7.x = 70;
- point7.y = point7.sine(point7.x);
- mySine point8;
- point8.x = 80;
- point8.y = point8.sine(point8.x);
- mySine point9;
- point9.x = 90;
- point9.y = point9.sine(point9.x);
- mySine point10;
- point10.x = 100;
- point10.y = point10.sine(point10.x);
- mySine point11;
- point11.x = 110;
- point11.y = point11.sine(point11.x);
- mySine point12;
- point12.x = 120;
- point12.y = point12.sine(point12.x);
- mySine point13;
- point13.x = 130;
- point13.y = point13.sine(point13.x);
- mySine point14;
- point14.x = 140;
- point14.y = point14.sine(point14.x);
- mySine point15;
- point15.x = 150;
- point15.y = point15.sine(point15.x);
- mySine point16;
- point16.x = 160;
- point16.y = point16.sine(point16.x);
- mySine point17;
- point17.x = 170;
- point17.y = point17.sine(point17.x);
- mySine point18;
- point18.x = 180;
- point18.y = point18.sine(point18.x);
- mySine point19;
- point19.x = 190;
- point19.y = point19.sine(point19.x);
- mySine point20;
- point20.x = 200;
- point20.y = point20.sine(point20.x);
- mySine point21;
- point21.x = 210;
- point21.y = point21.sine(point21.x);
- mySine point22;
- point22.x = 220;
- point22.y = point22.sine(point22.x);
- mySine point23;
- point23.x = 230;
- point23.y = point23.sine(point23.x);
- mySine point24;
- point24.x = 240;
- point24.y = point24.sine(point24.x);
- mySine point25;
- point25.x = 250;
- point25.y = point25.sine(point25.x);
- mySine point26;
- point26.x = 260;
- point26.y = point26.sine(point26.x);
- mySine point27;
- point27.x = 270;
- point27.y = point27.sine(point27.x);
- mySine point28;
- point28.x = 280;
- point28.y = point28.sine(point28.x);
- mySine point29;
- point29.x = 290;
- point29.y = point29.sine(point29.x);
- mySine point30;
- point30.x = 300;
- point30.y = point30.sine(point30.x);
- mySine point31;
- point31.x = 310;
- point31.y = point31.sine(point31.x);
- mySine point32;
- point32.x = 320;
- point32.y = point32.sine(point32.x);
- mySine point33;
- point33.x = 330;
- point33.y = point33.sine(point33.x);
- mySine point34;
- point34.x = 340;
- point34.y = point34.sine(point34.x);
- mySine point35;
- point35.x = 350;
- point35.y = point35.sine(point35.x);
- mySine point36;
- point36.x = 360;
- point36.y = point30.sine(point36.x);
- mySine point37[36]={point1,point2,point3,point4,point5,point6,point7,point8,point9,point10,point11,point12,point13,point14,point15,
- point16,point17,point18,point19,point20,point21,point22,point23,point24,point25,point26,point27,point28,point29,
- point30 ,point31,point32,point33,point34,point35,point36 };
- cout<<"x"<<setw(20)<<"y=sin(x)"<<endl;
- for(int j=0;j<36;j++)
- {
- cout << point37[j].x<<setw(20)<<point37[j].y<<endl;
- }
- cout<<"------------------------------------------------------------------------------------------------------------"<<endl<<endl;
- cout<<"sine wave :"<<endl<<endl; //to display sine wave
- cout<<1<<endl;
- cout<<setw(28)<<right<<"****"<<endl;
- cout<<0.8<<setw(19)<<right<<"*"<<setw(8)<<right<<"*"<<endl;
- cout<<setw(19)<<right<<"*"<<setw(12)<<right<<"*"<<endl;
- cout<<0.6<<setw(14)<<right<<"*"<<setw(15)<<right<<"*"<<endl;
- cout<<setw(15)<<right<<"*"<<setw(18)<<right<<"*"<<endl;
- cout<<0.4<<setw(10)<<right<<"*"<<setw(21)<<right<<"*"<<endl;
- cout<<setw(11)<<right<<"*"<<setw(24)<<right<<"*"<<endl;
- cout<<0.2<<setw(6)<<right<<"*"<<setw(27)<<right<<"*"<<endl;
- cout<<setw(7)<<right<<"*"<<setw(30)<<right<<"*"<<endl;
- cout<<0<<setw(4)<<right<<"*"<<setw(33)<<right<<"*"<<endl;
- cout<<setw(39)<<right<<"*"<<setw(22)<<right<<"*"<<endl;
- cout<<-0.2<<setw(36)<<right<<"*"<<setw(20)<<right<<"*"<<endl;
- cout<<setw(41)<<right<<"*"<<setw(18)<<right<<"*"<<endl;
- cout<<-0.4<<setw(38)<<right<<"*"<<setw(16)<<right<<"*"<<endl;
- cout<<setw(43)<<right<<"*"<<setw(14)<<right<<"*"<<endl;
- cout<<-0.6<<setw(40)<<right<<"*"<<setw(12)<<right<<"*"<<endl;
- cout<<setw(45)<<right<<"*"<<setw(10)<<right<<"*"<<endl;
- cout<<-0.8<<setw(42)<<right<<"*"<<setw(8)<<right<<"*"<<endl;
- cout<<setw(52)<<right<<"****"<<endl;
- cout<<-1<<setw(26)<<100<<setw(13)<<200<<setw(17)<<300<<endl;
- cout<<endl<<"-------------------------------------------------------------------------------------------------------------"<<endl<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement