944,166 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1630
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
May 8th, 2006
0

I need help urgently on Arrays and functions

Expand Post »
HI, I need to create a program which tests whether within a range given by the user, there exists an extreme of quadratic function (y=ax2+bx+c). The parameters (a,b,c) of this function are given by the user. I just started it but I have a problem in completing it. This is how far I can go.
#include <stdio.h>
int x;
int y;
int a,b,c;
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
honeybleak is offline Offline
1 posts
since May 2006
May 8th, 2006
0

Re: I need help urgently on Arrays and functions

Quote originally posted by honeybleak ...
HI, I need to create a program which tests whether within a range given by the user, there exists an extreme of quadratic function (y=ax2+bx+c). The parameters (a,b,c) of this function are given by the user. I just started it but I have a problem in completing it. This is how far I can go.
#include <stdio.h>
int x;
int y;
int a,b,c;
Can you explain what you mean more clearly?
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
May 8th, 2006
0

Re: I need help urgently on Arrays and functions

C++ Syntax (Toggle Plain Text)
  1. #include <stdio.h>
  2. int x;
  3. int y;
  4. int a,b,c;
  5.  
  6. int main()
  7. {
  8. // put your code here
  9.  
  10.  
  11. return 0;
  12. }
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,963 posts
since Aug 2005
May 8th, 2006
0

Re: I need help urgently on Arrays and functions

Do u need a complete program for this I justcreated one for calculating the roots of QUADRATIC EQUATIONS.
Replyto this if u need one or anyone else will copyit and use it.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cool Nanu is offline Offline
10 posts
since May 2006
May 8th, 2006
4

Re: I need help urgently on Arrays and functions

No, that's not what's being asked for. honeybleak, do you know how to do the calculation on paper?
Team Colleague
Reputation Points: 1135
Solved Threads: 173
Super Senior Demiposter
Rashakil Fol is offline Offline
2,480 posts
since Jun 2005
May 8th, 2006
0

Re: I need help urgently on Arrays and functions

see this article
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,963 posts
since Aug 2005
May 8th, 2006
2

Re: I need help urgently on Arrays and functions

That link has nothing to do with finding the global extremum, which is located at -b/2a. (If a = 0 then there is no global extremum.)
Team Colleague
Reputation Points: 1135
Solved Threads: 173
Super Senior Demiposter
Rashakil Fol is offline Offline
2,480 posts
since Jun 2005
May 8th, 2006
0

Re: I need help urgently on Arrays and functions

What does your avatar mean or represent Mr Rashakil? Remember the ancient dragon is no maths wizz kid :-)
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
May 8th, 2006
2

Re: I need help urgently on Arrays and functions

I don't think it's a question of math, people just misinterpreted the problem (or had read the first misinterpretation of the problem). Why would I tell anybody what my avatar is?
Team Colleague
Reputation Points: 1135
Solved Threads: 173
Super Senior Demiposter
Rashakil Fol is offline Offline
2,480 posts
since Jun 2005
May 8th, 2006
0

Re: I need help urgently on Arrays and functions

you have to check the bounds. i.e. if someone inputs the range ( -1 , 2 ). you should check the following.

let f(x) = ax^2 + bx + c .
check f(-1), f(2) and f(-b/2a).

since this is a quadratic it can be assumed that a != 0.

if you are looking for mins and max those are the only possible places they can occur ( local extrema f(-1), f(2) ) and a global extrema f(-b/2a).
Reputation Points: 10
Solved Threads: 1
Newbie Poster
soxers12 is offline Offline
4 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How to capture the system idle time in c/c++
Next Thread in C++ Forum Timeline: how to capture the system idle time using c/c++





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC