Comments

Tuesday, August 27, 2013

Find the Roots Quadratic of the equations

Posted by at 3:51 AM Read our previous post


Object:
Find the Roots Quadratic of the equations
Source Code:

#include <iostream>
using namespace std;

class divide
{
public:
       int *ans(int A,int B,int C)
       {
              int answer[2],pos,sop;

              // product of sum -b/a

              // sum of product c/a

              pos=-(B/A);
              sop=(C/A);
             
              answer[0]=pos;
              answer[1]=sop;
             
              return answer;
       }

};
void main()
{
       divide div;
       int number1,number2,number3, *ptr;
       cout<<"Enter Value of ax ^2"<<endl;
       cin>>number1;
       cout<<"Enter Value of bx"<<endl;
       cin>>number2;
       cout<<"Enter Value of c"<<endl;
       cin>>number3;

       ptr=div.ans(number1,number2,number3);

       cout<<" Product of sum : "<<ptr[0]<<" Sum of Product : "<<ptr[1]<<endl;
}
Output:

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template