C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 22nd, 2006, 11:49 AM
confuseddude confuseddude is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 1 confuseddude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 34 sec
Reputation Power: 0
Program help please!!!

i am suppossed to write a program to do the following "Using the ADT complex, write a program to determine the real roots of the quadratic equation, where a does not equal 0, after requesting the values of a, b, and c.

Note: The equation has 2 real roots if is positive, 1 real root if is zero, or 2 imaginary roots if is negative. The solutions are given by the quadratic formula:"

here is the class we are supposed to use or modify slightly to do this program.

class Complex { // complex number object
public:
Complex(); // default constructor
Complex( double, double ); // constructor that initializes real, imag
Complex( double ); // constructor that permits conversion
// from real to Complex
double getReal(); // accessor, returns the real part of a complex number object
double getImag(); // accessor , returns the imaginary part of a complex number
friend Complex operator + (const Complex &, const Complex &);
//overloads the + operator to allow complex number object + complex number object

friend Complex operator - (const Complex &, const Complex &);
//overloads the - operator to allow complex number object += complex number object

private:
double real; //the real part of a complex number object
double imag; //the imaginary part of a complex number object
friend istream & operator >> ( istream&, Complex& );
//overloads the >> operator to allow cin >> complex number object
friend ostream& operator << ( ostream&, const Complex& );
//overloads the << operator to allow cout << complex number object

};

i'm really confused at how to start this program, my teacher spent one class period teaching classes and abstract data types, i have a final on it on monday, i'm screwwed for that but i would like to get this program done.. any help would be greatly appreciated!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Program help please!!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT