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.
The calculated integer values of x and y for which f(x,y) reaches its minimum and maximum on [a, b] x [c, d].

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

thnx in advance

6 Years
Discussion Span
Last Post by iamuser_2007

No one here is going to write a solution for you.

If you have a specific question, post the code you have (in code tags) along with any current errors and people in the community would gladly help you see how to fix what's wrong.

This website is not your own personal programming language tutor though. If we just gave you code to turn in, what would you learn from that?

Just try first.

nicely put :)
#include <iostream>
using namespace std;

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

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

 cout<<"b =";

 cout<<"c =";

 cout<<"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 ";

Now please tell me what to do

Edited by Nick Evan: Added [CODE]-tags


Oh wow, talk about lazy... you didn't even attempt to solve the actual problem... you just wrote some simple output and an IF statement. And the assignment called for floating point numbers, not doubles...
If you aren't will to make a serious attempt at the program yourself, nobody here is going to so much as reply to your thread, except perhaps to tell you to do it yourself.

<scoff> Good day, sir...


>And the assignment called for floating point numbers, not doubles...
Doubles are floating-point numbers. float is single precision and double is double precision. Otherwise I agree with your post. :)


i am a beginner programmer. i don't know much.
i know this code only please can any one help me to solve all problem.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.