#include cout << 3.298191873918731; // only 6 digits after . cout << setprecision(15) << 3.298191873918731; << setw(32) << vector stack; vector names; vector values; assignment example: 2 3 * 4 + -> answer 5 2 3 * 4 + -> x * 65 -> x x * ------------------------------- fast to the power of X to the power of 147 128, 19 left 16, 3 left 2, 1 left 1 10010011 X ttpo (128 + 16 + 2 + 1) (X ttpo 128) * (X ttpo 16) * (X ttpo 2) * (X ttpo 1) & bitwise and: any zero => zero, no zeros => 1 | bitwise or: any one => one, no ones => 0 ^ exclusive or: bits are different => 1, not => zero want X ttpo Y val = 1 1 X X * X*X X^19 X^147 pow = X X X*X X*X*X*X X^8 X^16 X^32 X^64 X^128 X^256 while Y != 0 147 73 36 18 9 4 2 1 0 if Y & 1 == 1 val *= pow pow *= pow Y >>= 1 return val ---------------------------------------- { int A[100]; can't change size, can't get rid of it ... ...; } can't keep it after here (alternative end) return A; } big trouble! int * f() { int * A; a is a pointer to (an array of) int A = new int[100]; ... A[37] += 1; A[34] = 6 * A[0]; ...; if (x != 72) delete [] A; can get rid of array but can't make it bigger, but ... ...; ...; } a still exists! (or) return A; } perfectly OK int * Arr = f(); int * A = new int[100]; ... ... realise it's too small int * temp = new int[1000]; for (int i = 0; i < 100; i += 1) temp[i] = A[i]; delete [] A; A = temp; ... just as good as being able to enlarge the original struct vectorofdoubles { protected: double * data; int size, nitems; public: vectorofdoubles(int initialsize = 0) { data = new double[initialsize]; size = initialsize; nitems = 0; } #include void push_back(double d) { if (nitems == size) grow(); data[nitems] = d; nitems += 1; } double back() { if (nitems == 0) { cerr << "\n****** Error, back() on empty vector ******\n"; return 0.0; } (or) if (nitems == 0) { cerr << ... exit(1); } (or) assert(nitems != 0); return data[nitems - 1]; } void pop_back() { // same tests as back() nitems -= 1; } ---------------------------------------------------------------- reading a whole line at once (for the assignment) Don't use cin >> ... use this instead: string inputline; getline(cin, inputline); That's all it takes. inputline will contain everything on the line, right up to (but not including) the \n that terminated it. If the user types a blank line, inputline will be the empty string "". Remember the do-it-yourself rule. For this assignment you #include but nothing else that is normally not allowed, especially