AddO1f

LabF4

Apr 3rd, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #pragma once
  2. #include "cmath"
  3.  
  4. #pragma endregion
  5. private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
  6.             double x,xn,xk,xh;
  7.             Series^ plot1 = chart1->Series[0];
  8.             plot1->Points->Clear();
  9.             if((textBox1->Text!="")&&(textBox2->Text!="")&&(textBox3->Text!=""))
  10.             {
  11.                 xn = Convert::ToDouble(textBox1->Text);
  12.                 xk = Convert::ToDouble(textBox2->Text);
  13.                 xh = Convert::ToDouble(textBox3->Text);  
  14.                 if ((xn>=xk)||(xh>(xk-xn)))  
  15.                 {  
  16.                     MessageBox::Show( "Данные заполнены неверно", "Ошибка ввода данных",MessageBoxButtons::OK,MessageBoxIcon::Exclamation );
  17.                 }  
  18.                 else
  19.                 {
  20.                     x=xn;
  21.                     while (x<=xk)  
  22.                     {
  23.                         plot1->Points->AddXY(x, (pow(x,4)+2*pow(x,3)-x)/pow(cos(x+3),2));
  24.                         x=x+xh;
  25.                     }
  26.                 }
  27.             }
  28.             else
  29.             {
  30.                 MessageBox::Show( "Заполните пожалуйста данные", "Ошибка ввода данных",MessageBoxButtons::OK,MessageBoxIcon::Exclamation);
  31.             }
  32. }
  33. private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {Application ::Exit();
  34.          }
  35. };
  36. }
Advertisement
Add Comment
Please, Sign In to add comment