May 2002
Beginner
320 pages
6h 18m
English
The GetOperator() and GetOperand() functions in main.cpp can first get input from the saved tape. When that runs out, they can then get input from cin instead. Listing 16.2 shows how this works.
1: #include <iostream> 2: #include <ios> 3: #include <fstream> 4: 5: #include "PromptModule.h" 6: #include "ErrorHandlingModule.h" 7: #include "AccumulatorModule.h" 8: #include "TapeModule.h" 9: #include "ExternalInterfaceModule.h" 10: 11: using namespace std; 12: *13: ifstream TapeInputStream; // Global variable for callback 14: 15: char GetOperator(void) 16: { 17: char Operator; 18: 19: if 20: ( *21: TapeInputStream.is_open() && *22: (!TapeInputStream.eof()) 23: ... |
Read now
Unlock full access