# How do I fix these Errors??

• 10-20-2002
Maiq
How do I fix these Errors??
Hello everyone. I've been trying to figure out how to fix these errors for about two hours now and I have yet to figure out how. Here are the errors I get:
http://www.carbongraphx.com/errors.jpg
Here's my program:
Code:

```//fun.cpp //Jason Smith /*This program converts Celsius to Fahrenheit values, finds volume of a given   sphere, and the hypotenuse of a given right triangle*/ #include <iostream.h> #include <iomanip.h> #include <math.h> const float PI = 3.14159; double ctoF(double celsius); double volume(double radius); double hypotenuse(double firstleg, double secondleg, double c); double ftoC(double fahr); void intro(); int main() {         double celsius, fahr, radius, firstleg, secondleg;         intro();         cout <<"Enter a Celsius temperature to be converted to Fahrenheit: ";         cin >>celsius;         cout <<endl;         cout <<"Enter a Fahrenheit temperature to be converted to Celsius: ";         cin >>fahr;         cout <<endl;         cout <<"Enter the radius of the sphere: ";         cin >>radius;         cout <<endl;         cout <<"Enter the legs of the right triangle with a space between them: ";         cin >>firstleg >>secondleg;         cout << setiosflags(ios::right|ios::fixed|ios::showpoint);         cout << setprecision(2);         cout << celsius <<" degress C = " << ctoF(celsius) <<" degrees F."<<endl;         cout << fahr <<" degrees F = " << ftoC(fahr) <<" degrees C."<<endl;         cout <<"The volume of a sphere of radius "<<radius<<" is "<< volume(radius) <<".";         cout <<"The hypotenuse of a right triangle of legs "<< firstleg <<" and "<< secondleg             <<" is "<< hypotenuse(firstleg, secondleg) <<".";                } void intro() {         cout << "Program: Fun.CPP";         cout << "By Jason Smith on October 20, 2002";         cout <<endl;         cout << "**This program converts Celsius to Fahrenheit values,\n";         cout << "finds the volume of a given sphere, and the hypotenuse \n";         cout << "of a given right triangle.\n";         cout << "***LET THE FUN COMMENCE!!***";         cout <<endl;         cout <<endl; } double ctoF(double celsius) {         return ((1.8*celsius) + 32); } double ftoC(double fahr) {         return (5/9 * (fahr - 32)); } double volume(double radius) {         return (4/3*(PI * (double pow(double radius, double 3))); } double hypotenuse(double firstleg, double secondleg, double c) {         c = (double pow(double firstleg, double 2)) + (double pow(double secondleg, double 2));         return (double sqrt(double c)); }```
Any help would be greatly appreciated. Thanks.
Jason

• 10-20-2002
moi
really, the error message is in basic english. you define a function hypotnuse() which takes three double args, and then you try to call it with only two.

now of course you're program has other errors as well, but dont sit there and tell me you couldn't figure that one out.
• 10-20-2002
master5001
By the way, quote tags are no replacement for code tags. Also here is a helpful tip. You can do this:

Code:

```double hypotenuse(double firstleg, double secondleg, double c = 1.0) {     c = (double pow(double firstleg, double 2)) + (double pow(double secondleg, double 2));     return (double sqrt(double c)); }```

Almost forgot. When you set "default" values like this you mush also prototype them with the default value. Actually, once prototyped with a default value I don't think you need the default value in the function declaration.

example prototype:
Code:

`double hypotenuse(double,double,double=1.0);`
[/edit]
• 10-21-2002
ammar
You have many problems in your program...
For example:
in addition to what moi said...
You should return a value in the main()...
What do you mean by this:
Quote:

return (double sqrt(double c));
double pow(double secondleg, double 2)
???
I don't get it, what are you trying to do?
• 10-21-2002
Maiq
ammar:
the 'pow' function is the power function, which takes double x to the power of double y ex: double pow(double x, double y) but i can see that, yes, i messed up the order there.

thanks everyone.
• 10-22-2002
waldis
I thought i'll comment on this:

Code:

```double ftoC(double fahr) { return (5/9 * (fahr - 32)); }```
This won't work unless you put 5.0/9.0, it is looking for double type, but all it sees are int, so it'll skip them.

Val :)