The Tape

The Tape() function is fairly simple, and is coded in main.cpp.

Listing 12.1. Tape() in main.cpp
 1: void Tape(const char theOperator,const float theOperand) 2: { 3: static const int myTapeSize = 20; // Array size 4: 5: static char myOperator[myTapeSize]; // Operator part 6: static float myOperand[myTapeSize]; // Operand part 7: 8: static int myNumberOfEntries = 0; // What's in tape now 9: 10: // Remember that arrays start with element 0 11: // And that the highest element is the size - 1; 12: 13: if (theOperator != '?') // Add to the tape 14: { 15: if (myNumberOfEntries < myTapeSize) // We have room 16: { 17: myOperator[myNumberOfEntries] = theOperator; 18: myOperand[myNumberOfEntries] = theOperand; 19: myNumberOfEntries++; 20: } 21: ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.