• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

quick c++ question

Pegun

Golden Member
Has anyone ever heard of or used the return type Error_code in c++ .net version? I'm trying to write a function of a class to provide an error code if the stack is full using the following code:

Error_code Extended_stack:😛ush(Stack_entry item)
/*Pre: None
Post: If the stack is not full, item is added to the top of the stack.
If the stack is full, and error_code of underflow is returned and the
stack is left unchanged*/
{
Error_code outcome = success;
if(count >= maxstack)
outcome = overflow;
else
entry[count++] = item;
return outcome;
}

The compiler wont let me use Error_code even when i define it in my public functions.
 
according to the book I'm using its supposed to be built in, i think. what I'm trying to do is push and pop stack elements. Is there another way to do it?
 
nevermind...the book didnt say you had to define it as an enum with success, overflow, underflow parameters
 
Back
Top