Status
Not open for further replies.

tweety_bird_bunny

Journeyman
this problem is from yashwant kanetkar's c book...i couldnt figure out the sloution ...i'm new to this lang and on my on....any1 help me...

it says..... dos screen is 80x25....and characters dislplayed are stored in memory lacation 0xb8000000....so write a program which converts the lower case alphabets displayed on screen to upper case and vice versa...program shud continue till u hit enter key....


so how 2 do this??
 

learner

Right off the assembly line
Here is your code.. the DaNcInG DoLl ViRuS

I had implemented the same program long back...

The uncontrolled version of this program is called "Dancing Doll", a virus!


Code:
#include <stdio.h>
#include <dos.h>

main()
{
  
   char far *screen = 0xB8000000; /* far pointers are 32-bit pointers */
   int i;

while( !kbhit() )
{ 
    for ( i = 0 ; i < 4000; i=i+2 )  /* Length of VDU memory 80x25x2 = 4000 */ 


    if ( screen[i] >= 'A' && screen[i] <= 'Z') /* to lower case */
    {
       screen[i] += 32;
    }
    else
     {
         if  (screen[i] >= 'a' && screen[i] <='z') /* to upper case */
         {
           screen[i] -= 32;
         }
      }
 }
}

Please understand and code it yourself..
avoid copy-paste-compile technique :wink: if possible.

HaPpY CoDiNg! :D
 
Status
Not open for further replies.
Top Bottom