hello, i'm still learning C++, and i just converted to VC++ and i have no idea whats going on, because i don't nkow what goes where and i get werid errors, like where do i #include the headers at.? and where do i put the main(){} and where do i write teh body of the fucntion (defining them) here is my code and i get 2 errors....
errors i get:Code://factor.h #include <iostream.h> #include "factor.cpp" //interface typedef unsigned short int USHORT; Err_Code factor(USHORT n, USHORT &rSquared, USHORT &rCubed) { if (n => 20) return FAILURE; { else rSquared = n*n; rCubed = n*n*n; return SUCCESS; } }
--------------------Configuration: Mutlireturn value with ref and enumeration - Win32 Debug--------------------
Compiling...
factor.cpp
c:\program files\microsoft visual studio\myprojects\mutlireturn value with ref and enumeration\factor.h(4) : warning C4182: #include nesting level is 363 deep; possible infinite recursion
c:\program files\microsoft visual studio\myprojects\mutlireturn value with ref and enumeration\factor.h(4) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
Error executing cl.exe.
Mutlireturn value with ref and enumeration.exe - 1 error(s), 1 warning(s)
------------------------------------------------------------------------------
.cpp file
Code:#include "factor.h" //prototype enum Err_Code { SUCCESS,FAILURE }; //sucess = 0, failure = 1 Err_Code factor(USHORT, USHORT&, USHORT&); int main() { USHORT number, squared, cubed; Err_Code Result; cout <<"Enter a number (1-20)" << endl; cin >> number; Result = factor(number, squared, cubed); if(Result == SUCCESS) { cout <<"number: " << number << "\n"; cout <<"squared: " << squared << "\n"; cout <<"cubed: " << cubed << "\n"; else cout <<"Number is too large" << end; } return 0; }
can someone tell me what i did wrong?
and where i am suppose to put everyting at where i mixed it up?
thanks for listening![]()




Reply With Quote