Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include "stdio.h"
  3. #include <iostream>
  4.  
  5. double proc(double x){
  6.  double rez = 0;
  7.  int status;
  8.  const double c2 = 5/3;
  9.  const int c3 = 2;
  10.  
  11.  __asm{
  12.   finit
  13.    fld x;//x
  14.   fld x; //x x
  15.   fmul;//x^2
  16.   fld x;//x x^2
  17.   fmul;//x^3
  18.   fld x;//x x^3
  19.   fmul;//x^4
  20.   fld x;//x x^4
  21.   fmul;//x^5
  22.   fld x;//x x^5
  23.   fld x;//x x x^5
  24.   fmul;//x^2 x^5
  25.   fld x;//x x^2 x^5
  26.   fmul;//x^3 x^5
  27.   fld c2;//5/3 x^3 x^5
  28.   fmul//5*(x^3)/3 x^5
  29.   fld c3;//2 5*(x^3)/3 x^5
  30.   fadd;//2+5*(x^3)/3 x^5
  31.   fadd; //2+5*(x^3)/3 x^5
  32.   fstp rez;// сохранение результата
  33.  
  34.  
  35.  }
  36.  return rez;
  37.  
  38. }
  39.  
  40. int _tmain(int argc, _TCHAR* argv[])
  41. {
  42.  
  43.  setlocale(LC_ALL,"Russian");
  44.  printf("Рыков Иван 6112-Б\nвариант №22\n");
  45.  printf( "y= x^5 - (5*x^3)/3 + 2 \n");
  46.  
  47.  double x;
  48.  
  49.   std::cout << "x = ";
  50.   std::cin >> x;
  51.   std::cout << "f(x)= " <<proc(x) << "\n";
  52.   x = 0;
  53.   for (int i = 2; i <= 20; i++)
  54.   {
  55.    x += 0.1;
  56.    std::cout << "№ " << i << "  x= " << x << "      f(x)= " << proc(x) << "\n";
  57.   }
  58.   std::cout << std::endl;
  59.  system("Pause");
  60.  
  61.  return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement