Quipex

zadanie_4

Oct 5th, 2015
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. // zadanie_4.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <math.h>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     float xn,xk,dx,x,y,max=0,min=1;
  13.     cout<<"xn, xk, dx"<<endl;
  14.     cin>>xn>>xk>>dx;
  15.     int i=0;
  16.     for(x=xn;x<=xk;x+=dx)
  17.     {
  18.         y=exp(cos(pow(x,3))); //cout<<y<<endl;
  19.         i++;
  20.         if(i%3==0)
  21.         {
  22.             cout<<"x:"<<x<<setw(15)<<"y:"<<y<<endl;
  23.         }
  24.         if(y>x)
  25.         {
  26.             if(y>max)
  27.             {
  28.                 max=y;
  29.             }
  30.         }
  31.         else
  32.         {
  33.             if(y<=min)
  34.             {
  35.                 min=y;
  36.             }
  37.         }
  38.     }
  39.     cout<<endl;
  40.     if(min==1) cout<<"netu minimalnogo sredi y<=x"; else cout<<endl<<"min: "<<min<<endl;
  41.     if(max==0) cout<<"netu maximalnogo sredi y>x"; else cout<<endl<<"max: "<<max<<endl;
  42.     system("pause");
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment