Advertisement
Jgug

Laba№3_v2

Nov 26th, 2012
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. // Laboratornaya_Rabota_2_v01.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <math.h>
  6. #include <iomanip>
  7. #include <iostream>
  8. #include <stdio.h>
  9. #include <conio.h>
  10.  
  11. using namespace std;
  12.  
  13. double result;
  14.  
  15. class Y;
  16. class X
  17. {
  18.     private:
  19.        double x;
  20.        double y;
  21.     public:
  22.        X ()
  23.        {
  24.            x=0.4e4;
  25.            y=-0.875;
  26.        }
  27.     friend void run (X, X, Y);
  28.     friend void print (X, X, Y);
  29.     ~ X() {}
  30. };
  31.  
  32. class Y
  33. {
  34.     private:
  35.        double z;
  36.     public:
  37.        Y ()
  38.        {
  39.            z=-0.475e-3;
  40.        }
  41.     friend void run (X, X, Y);
  42.     friend void print (X, X, Y);
  43.     ~ Y() {}
  44. };
  45.  
  46.  
  47. void run (X, X, Y)
  48. {
  49.     X r1;
  50.     X r2;
  51.     Y r3;
  52.     result = pow( (fabs(cos(r1.x) - cos(r2.y))), (1+2*sin(r2.y)*sin(r2.y))) * (1+r3.z+pow(r3.z,2)/2.+pow(r3.z,3)/3.+pow(r3.z,4)/4.);
  53. }
  54.  
  55. void print (X, X, Y)
  56. {
  57.     cout<<result<<endl;
  58. }
  59.  
  60. void main()
  61. {
  62.     X f1;
  63.     X f2;
  64.     Y f3;
  65.     run (f1, f2, f3);
  66.     print (f1, f2, f3);
  67.     _getch();
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement