krutmaster

CCL_library

Feb 8th, 2021 (edited)
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <cmath>
  2. #include "pch.h"
  3.  
  4. //using namespace System;
  5. //using namespace System::Windows::Forms;
  6. using namespace std;
  7.  
  8. double Count(double x, double e, int Nmax, System::Windows::Forms::ListBox^ LB)
  9. {
  10.     double y0, y;
  11.     y = 1;
  12.     int i = 0;
  13.     do
  14.     {
  15.         y0 = y;
  16.         y = 1.5 * y0 - 0.5 * x * y0 * y0 * y0;
  17.         i++;
  18.         System::String^ fs = System::String::Format("{0,2:D2}{1,15:F9}", i, y);
  19.         LB->Items->Add(fs);
  20.         //cout << "Итерация " << i << ": Значение уравнения " << y << endl;
  21.     } while (abs(y - y0) >= e && i < Nmax);
  22.     return y;
  23. }
Add Comment
Please, Sign In to add comment