0

Why this source code compiles error?

#include <iostream> using namespace std; class Stack { int *p = new int[num]; int num = 0; public: Stack& operator<<(int x); void operator >> (int &x); bool operator!(); }; bool Stack::operator!() { if (num == 0) return true; else return false; } Stack& Stack::operator<<(int x) { num++; p[num - 1] = x; return *this; } void Stack::operator >> (int &x) { x = p[num - 1]; num--; } int main() { Stack stack; stack << 3 << 5 << 10; while (true) { if (!stack) break;

4th May 2018, 7:04 AM
권진
2 Respostas
+ 1
Save your code on code playground section (that here seem is not full), copy his url and post here
4th May 2018, 9:08 AM
KrOW
KrOW - avatar
0
please help me:(
4th May 2018, 7:05 AM
권진