Monday, 26 August 2013

Chapter 8 Solutions Problem [I][e]

Question-The screen is divided into 25 rows and 80 columns. The 
characters that are displayed on the screen are stored in a 
special memory called VDU memory (not to be confused with 
ordinary memory). Each character displayed on the screen 
occupies two bytes in VDU memory. The first of these bytes 
contains the ASCII value of the character being displayed, 
whereas, the second byte contains the colour in which the 
character is displayed. 
For example, the ASCII value of the character present on 
zeroth row and zeroth column on the screen is stored at 
location number 0xB8000000. Therefore the colour of this 
character would be present at location number 0xB8000000 + 
1. Similarly ASCII value of character in row 0, col 1 will be at 
location 0xB8000000 + 2, and its colour at 0xB8000000 + 3. 
With this knowledge write a program which when executed 
would keep converting every capital letter on the screen to 
small case letter and every small case letter to capital letter. 
The procedure should stop the moment the user hits a key 
from the keyboard. 
This is an activity of a rampant Virus called Dancing Dolls. 
(For monochrome adapter, use 0xB0000000 instead of 

0xB8000000). 

Solution-
This problem is not for beginners.This program requires use of Standard Libraries like <Dos.h>. we will see these type of problems in further chapters and also this also deals with the concept of Hexadecimal storage way.So, this problem can be ignored for now. it's logic is fairly simple ,which is suppose we have assigned char variable f for capital letter. We are just supposed to make c=c+32; similarly in case of small case letter we just need to c=c-32; and computer will do the rest .so, that's all for this problem.

1 comment:

  1. dont know why kanetkar provide tis type of big problem

    ReplyDelete