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;
2 Respostas
+ 1
Save your code on code playground section (that here seem is not full), copy his url and post here
0
please help me:(