hello everyone, i'm new to C++, and i'm using VC++6.0 as the compiler, well here is the code...the error i get is this:
--------------------Configuration: Returning Mutli values - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Returning Mutli values.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Returning Mutli values.exe - 2 error(s), 0 warning(s)
------------------------------------------------------------------
here is my code: in math.h
Code:#include <iostream.h> #include "math.cpp" //prototype typedef unsigned short int USHORT; USHORT factor(USHORT, USHORT*, USHORT*); int main() { short question; USHORT number, squared, cubed; cout <<"Enter a number (0-20); cin >> question; //function number = factor(number,squared,cubed); if(number <= 20) { cout << "Number: " << "\n"; cout << "Squared: " << "\n"; cout << "Cubed: " << "\n"; { else cout <<"Error Number too big!" << endl; } } return 0; }
here is the code in math.cpp:
Code://math.cpp //fucntion definition typedef unsigned short int USHORT; USHORT factor(USHORT n, USHORT*pSquared, USHORT*pCubed) { if (n > 20) return 1; //failure, too big. else { *pSquared = n*n; *pCubed = n*n*n; } return 0; //success! }
thanks for listening!




Reply With Quote