Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help!

Status
Not open for further replies.

wildtxn

Technical User
Sep 27, 2001
1
US
I am trying to write a program in C++ to simulate an electronic calculator and have no idea where to start please help...........

 
It's not hard to write a calculator in MFC depending on how complex you want it. Have you had any experience in C++ atleast? If you don't know C++ you should probably learn it before attempting to learn MFC.

 
The calculation part is just math and text/number conversions which you can do using standard c-library functions. Look at any basic C++ tutorial. Then you have to do the graphical interface part. In order for the program to appear as a standard "window" rather than text input and output in a dos prompt you have to create a "windows application" in this case one window with a bunch of buttons and a text box. There are two general ways to do this: MFC and Win32.

Win32
Windows has a library of functions called the "Win32 API" which allow you to talk to the operating system. Some of those functions are used to tell the operating system open a window, put things in the window like menus and text areas, and gather user input. It's not really that hard but it is too much to explain here so you should consult a tutorial.

A good basic step-by-step tutorial for this is called "theforgers win32 tutorial" which is around somewhere on the net.

MFC
Microsoft decided that the Win32 api was problematic, being just a big undifferentiated library of function calls, and organized them into a framework of C++ classes called MFC. One advantage of MFC is that it takes care of a lot of the basic details you have to do just to get a window to show up. It also provides a lot of convenience classes such as the famous CString for working with strings and classes which encapsulate a complex functionalities which would require a lot of code from the raw Win32 approach (such as dockable windows and multiple document interfacing).


If you are new to C++ you should just see if you can write the math part as a command line program. Then choose an approach for the windowing part and try to make a simple windows program. By that time you should be able to hook the two together.


-hope this helps
Good luck



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top