Sep 17, 2012 at 3:30pm UTC
I wanted to create a program that loops x's and input to a stack? Why doesn't it work? Please some advise.
Greetings repelsteeltje
#include <iostream>
using namespace std;
template< class T >
class Stack {
private:
int x = 1;
x++;
class = T x;
T x = st;
public:
Stack st [] []() {
push(st);
void st pop;
Push st :: ii.class
void pop :: -ii.class
}
int main();
{
cout << x;
Cout << push(st);
}
Sep 17, 2012 at 4:32pm UTC
You cannot start implementing and initializing stuffs in the class like what you've done. I mean: int x = 1; x++;
Either you do these in a constructor or some other friend function...
Sep 17, 2012 at 7:30pm UTC
hello,
a class is not a function. It tells the compiler how to organize memory.
This implementation needs a lot of work.
I don't want to sound to un-helpful, but its best that a review of class declarations is needed here.
http://www.cplusplus.com/doc/tutorial/classes/
I actually don't have room here to explain how to fix this.
Last edited on Sep 17, 2012 at 7:32pm UTC
Sep 17, 2012 at 10:07pm UTC
im actually surprised you know what a stack is at this point.
Last edited on Sep 17, 2012 at 10:07pm UTC