May 2002
Beginner
320 pages
6h 18m
English
You have been writing a lot of code to support performing division. Now you are ready to take a major step and make this simple program into a full-blown calculator. And the switch statement will be an important part of that change.
Let's start with the main() function, shown in Listing 11.1.
1: int main(int argc, char* argv[]) 2: { 3: SAMSErrorHandling::Initialize(); 4: 5: do 6: { 7: try 8: { *9: char Operator = GetOperator(); *10: float Operand = GetOperand(); 11: *12: cout << Accumulate(Operator,Operand) << endl; 13: } *14: catch (runtime_error RuntimeError) *15: { *16: SAMSErrorHandling::HandleRuntimeError (RuntimeError); *17: } 18: catch (...) 19: { 20: SAMSErrorHandling::HandleNotANumberError(); ... |
Read now
Unlock full access