Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does this program have error and wont compile?

Status
Not open for further replies.

lburden

Programmer
Nov 15, 2001
1
0
0
US
I have tried to get this program to run can somoene help me and tell me what wrong with it. It keeps giving me 22 errors when I try to compile it.





//*****************************************************
//*This program is to calculate the Quadratic formula**
//allowing user input
//@Author Larry Burden
//C++
//Program #2
//*****************************************************

#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

//declaration
float x1 (float, float, float);
float x2 (float, float, float);

int main()
{
float b;
float a;
float c;

//Input/Output

cout<<&quot;Enter the value of b&quot;<<endl<<endl;
cin>>b;
cout<<&quot;Enter the value of a&quot;<<endl<<endl;
cin>>a;
cout<<&quot;Enter the value of c&quot;<<endl<<endl;
cin>>c;

//Output
cout<<The value of x1 equals to &quot; <<setprecision (4)<< x1 (b,a,c) << endl<<endl;
cout<<The value of x2 equals to &quot; <<setprecision (4)<< x2 (b,a,c) << endl<<endl;

return 0;
}



//formula

float x1 (float b, float a, float c)

{
return (-b + sqrt (pow(b,2) - (4.0*a*c)))/(2.0*a);

}
 
A couple of quotes at the start of your two strings like so:

cout<<&quot;The value...

and all 20+ errors are gone (except that there's no x2() so the linker is not completely happy...) :) Hope that this helped! ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top