ok, pretty much the same thig as what i had before except without the typos:
Code:
#include<iostream>
#include<cstdlib>
#include<cmath>
//Prototypes
int quad(double a, double b, double c, double &a1, double &a2);
//Main Routine
int main()
{
double num1, num2, num3;
double ans1, ans2;
int type;
cout<<"Welcome to the .."<<endl;
cin>>num1>>num2>>num3;
type = quad(num1, num2, num3);
if (type==0)
{
cout<<ans1<<endl;
cout<<ans2<<endl;
}
else cout<<"no"<<endl;
}
//Functions
int quad(double a, double b, double c, double &a1, double &a2)
{
double temp;
if (a==0) return -1;
temp = b*b-4*a*c;
if (temp<0) return -2;
a1=(-b+sqrt(temp))/(2*a);
a2=(-b-sqrt(temp))/(2*a);
return 0;
}
And here are the errors.
Code:
quad.cpp:15: error: `int quad(double, double, double, double&, double&)'
redeclared as different kind of symbol
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/include/sys/types.h:566: error: previous
declaration of `typedef struct quad_t quad'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/include/sys/types.h:566: error: previous
non-function declaration `typedef struct quad_t quad'
quad.cpp:15: error: conflicts with function declaration `int quad(double,
double, double, double&, double&)'
quad.cpp: In function `int main()':
quad.cpp:24: error: `cout' undeclared (first use this function)
quad.cpp:24: error: (Each undeclared identifier is reported only once for each
function it appears in.)
quad.cpp:24: error: `endl' undeclared (first use this function)
quad.cpp:25: error: `cin' undeclared (first use this function)
quad.cpp:26: error: no matching function for call to `_quad::_quad(double&,
double&, double&)'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/include/sys/types.h:565: error: candidates
are: _quad::_quad()
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/include/sys/types.h:565: error:
_quad::_quad(const _quad&)
quad.cpp: In function `int quad(double, double, double, double&, double&)':
quad.cpp:38: error: `int quad(double, double, double, double&, double&)'
redeclared as different kind of symbol
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/include/sys/types.h:566: error: previous
declaration of `typedef struct quad_t quad'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/include/sys/types.h:566: error: previous
non-function declaration `typedef struct quad_t quad'
quad.cpp:38: error: conflicts with function declaration `int quad(double,
double, double, double&, double&)'