Main program to test the basic operations, C/C++ Programming

Assignment Help:

The Main program is slightly more complicated and you need to think about the I/O process. First of all, for most applications you do not call the low level routines GetChar and PutChar. They are used by the higher level I/O subroutines that you wrote for reading and writing strings and numbers.

Secondly, you cannot just call an input routine like GetStr or GetNum on its own. Think carefully about what would happen. Let's say at some point in your program you want to read a number from the keyboard and place it in a memory location. Consider the following code fragment:

MyNum: dw

Main:
...
...
call GetNum
mov MyNum1, ax

This code will assemble and run and when you enter a number and press ‘Enter' it will store the number at location MyNum. However, how does the person running the program know when to enter a number, or whether to enter a number or a string? When subroutine GetNum is called it will simply wait for input from the keyboard. But the program gives no indication that it is waiting for input! The simple answer is that you must always first write a string to the screen asking for the kind of input you want the user to enter, then call the appropriate input routine. So, our revised program should look like this:

Prompt1: db ‘Enter a number less than 65536:

MyNum: dw
Main:
...
...
Mov ax, Prompt1
Call PutStr
call GetNum
mov MyNum1, ax

Now when the program runs it first prints a message asking for a number and then waits for input. Try this out - if you have written your routines correctly, I think you will like the way this works.


Related Discussions:- Main program to test the basic operations

Explain operators, Operators The variables, which are declared and expl...

Operators The variables, which are declared and explained, are the operands, which are operated upon by the operators. Operators specify what operations are to be performed on

#title.jewel polish., Ask questionByteland county is very famous for lumino...

Ask questionByteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular

Reading from a Hash table in C, I''m having trouble with my C code to red f...

I''m having trouble with my C code to red from a Hash table. Not sure what it is I''m doing wrong and stumped. I need to get it figured out by tomorrow at 4:00 p.m. Eastern time. C

Experiment with the small test matrix, For this assignment, I've provided a...

For this assignment, I've provided a data file called 'elevation.mat', which contains the elevation data you'll be working with.   Type load elevation.mat to get the varia

Does improper inheritance have potential to wreck a project, Does improper ...

Does improper inheritance have a potential to wreck a project? Many projects meet a dead end due to bad inheritance. Hence it certainly has potential to wreck a project. Sma

Define the char data type of c language, Define the Char Data Type of C Lan...

Define the Char Data Type of C Language? The char defines characters. The char type will usually require only 1 byte of internal storage. Every char type has an equivalent inte

Board coloring, n this problem u given a board in which some of the element...

n this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that no

Prepare a mt4 ea to clone mt4 trades to a binary options, Prepare a MT4 EA ...

Prepare a MT4 EA to clone MT4 Trades to a Binary Options Platform Project Description: I want an EA that clones MT4 Trades to Globaltrader365, GT Options and if possible othe

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd