write this program

hi.

plzz tell me.
i do not understand this question.
write this C++ program.


You have to write a program in C++ that computes the minimal and the maximal value of function f(x,y) obtained on an integer point in a given rectangle [a, b] x [c, d]. Your program should prompt the user to input numerical values of a, b, c and d, as floating point numbers, which are expected to be in a range from -100 thru 100. In case when minimal or maximal values do not exists, your program should output appropriate messages.


a=1, b=10, c=1, d=20, f(x,y)=1-x+x*x*y;





i am waiting
Thanks
Last edited on
plz tell me


//Now check this and tell me....

#include <iostream>
using namespace std;

int main()
{
double a,b,c,d,x,y,f;

cout<<"Please, enter four numbers:"<<"\n";
cout<<"a =";
cin>>a;

cout<<"b =";
cin>>b;

cout<<"c =";
cin>>c;

cout<<"d =";
cin>>d;
if (a>100 || b>100 || c>100 || d>100 || a<-100 || b<-100 || c<-100 || d<-100)
{
cout << "The entered numbers must be in a range from -100 thru 100 ";
}
else
{
for ( x=a; x<=b; x=x+0.01)
{
for ( y=c; y<=d; y=y+0.01)

f=1-x+x*x*y;

cout<<"f= "<<f<<"\n";

}
}
return 0;
}

Last edited on
You need to record the max and min values of f as you go thru the loop, then print the values of a, b, c, d for the max/min at the end.
Topic archived. No new replies allowed.