c lang prob....

Discussion in 'Networking' started by tweety_bird_bunny, Jan 25, 2006.

Thread Status:
Not open for further replies.
  1. tweety_bird_bunny

    tweety_bird_bunny New Member

    Joined:
    Oct 3, 2003
    Messages:
    211
    Likes Received:
    2
    Trophy Points:
    0
    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??
     
  2. learner

    learner New Member

    Joined:
    Feb 1, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Nerul, Navi Mumbai
    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
     
Thread Status:
Not open for further replies.

Share This Page