I am having a problem trying to come up with a way to build a stack that can handle both strings and floats in the same class. I am assuming a max of 5 elements in the stack to start with. I am also trying to avoid using malloc() and new when declaring the string, and using fixed arrays instead. Below is what I am pushing to the stack.
s.push( 1.0 );
s.push( 2 );
s.push( "three" );
s.push( 4 );
s.push( "FIVE" );
s.push( 6.6);
cout << s.pop() << endl;
I can't figure out a way to do this. Can someone please help me. Thanks.
s.push( 1.0 );
s.push( 2 );
s.push( "three" );
s.push( 4 );
s.push( "FIVE" );
s.push( 6.6);
cout << s.pop() << endl;
I can't figure out a way to do this. Can someone please help me. Thanks.