// file celsius to F
// calculate from c to f in the depth st

#include <iostream>
using namespace std;

float celsiusAtDepth (float);
float CtoF (float);

int main ()
     float depth;
     float tempF, tempC;
     // get depth
     cout<< " Enter depth in Km " ;
     cin>> depth;
     //calculate temp
     tempC = celsiusAtDepth(depth);
     tempF = CtoF (tempC);
     //display result 
     cout << " At a depth of " << depth << " km inside the earth , " ;
     cout<< "\n the temperature would be : " << tempC << "degrees C , \n the temperature would be " << cout << tempF<< "degree F " << endl;
     system ( "pause " ) ;
     float celsiusAtdepth ( float depth)
           return ( (10 * depth)  +20);
     float CtoF (float cel)
           return (cel *1.8 +32 );

I dont know what the error with this program ,please help me

8 Years
Discussion Span
Last Post by skatamatic

the function name is different... the prototype has celsiusAtDepth and the definition has celsiusAtdepth...

float celsiusAtDepth (float);

float celsiusAtdepth ( float depth)

Read the error message - what does it say?

Also, please use code tags.

(Hing - check your spelling, capitalization counts.)


it did not run and the compiler said about the linking error sth

It will not run because it could not link. What does the linker error say? It should be telling you usefull information that will lead you to the solution.

RTFEM (Read The Full Error Message)


Generally a link error occurs when the linker cannot resolve a function to its declaration. The solution to this was already posted.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.