// zadanie_4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main()
{
float xn,xk,dx,x,y,max=0,min=1;
cout<<"xn, xk, dx"<<endl;
cin>>xn>>xk>>dx;
int i=0;
for(x=xn;x<=xk;x+=dx)
{
y=exp(cos(pow(x,3))); //cout<<y<<endl;
i++;
if(i%3==0)
{
cout<<"x:"<<x<<setw(15)<<"y:"<<y<<endl;
}
if(y>x)
{
if(y>max)
{
max=y;
}
}
else
{
if(y<=min)
{
min=y;
}
}
}
cout<<endl;
if(min==1) cout<<"netu minimalnogo sredi y<=x"; else cout<<endl<<"min: "<<min<<endl;
if(max==0) cout<<"netu maximalnogo sredi y>x"; else cout<<endl<<"max: "<<max<<endl;
system("pause");
return 0;
}
Comments