Calculator : Turbo C++
The following program is a Calculator that can be used to perform all the basic arithmetical operations. This program uses BGI graphics to create the user interface of the Calculator as well as to handle all of its special effects. If you need to learn about BGi Graphics, read How to Create Graphical Applications using Turbo C++ 3.0 IDE (BGI library) first.
This calculator can be used for performing all the basic arithmetical operations viz. addition, subtraction, multiplication, division and squaring. The calculator has a three dimensional shape, and so do all of its buttons. In other words, it looks like a real world, three-dimensional object rather than a two dimensional shape rendered in a program. This is one of its best features. The buttons change colour when you click the left mouse button over them, which gives the impression that they’re actually being clicked. The two buttons at the bottom i.e. C and E are used for resetting the calculator’s screen to default i.e. making it blank.
As you can see in the above images, the digits appear on the left side of the display and increase from left to right. In other words, as you click buttons and enter more digits, the later digits appear on the right. This has been done for the sake of simplicity and to avoid any possible errors that may pop up in the execution of the program.
Please Note that when you click on any of the arithmetical buttons i.e. +, –, *, / or sq^2 after entering the first number, the display becomes blank. Don’t worry, the number you entered has already been stored. Now, you have to enter the second number. After this, click =. The result of the operation would be displayed on the screen.
For example, as shown in the second image above, type 207936. Then click +. After this, enter the second number, say 9087. Now click = and the sum will be displayed on the screen. Simple !!! So, go on and check out the program.