Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

Chapter 8. The Calc Application

Calc is a spreadsheet program. The code is divided into several classes. It has the functionality to handle text, numerical values, and formulas composed by the four arithmetic operators. It also has the ability to change the font and color and the horizontal and vertical alignment. It also supports cut and paste as well as load and save. The references of a formula are relative, which means they are updated when the user cuts and pastes a block of cells to another location. The following screenshot depicts a classic example of the Calc Application:

  • We start by generating the code with the help of the Application Wizard.

  • We need the class Reference to keep track of references in the spreadsheet.

  • Then we look into formula generation. First we write the scanner, whose task is to put together sequences of characters into tokens, the smallest significant part of the formula.

  • Then we write the parser. Given a list of tokens, its task is to determine whether the formula...