i saw one question that to write a program for changing capital letter to small and small to capital by using vdu memory but it should stop the moment when user hits a key from the keyboard. i tried but it is not executing. this question is from LET US C book at 255 pg.no.
How can we access the vdu memory through a c program without using functions.?
This program changes the capital letter to small and vice versa but only if
there is a 'character'. so first type something to command prompt, dont use
clrscr() in the program after declaration and run it.
otherwise
try following
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
void main()
{
int a,b,i,r,c,ch;
char z='a';
char far *s;
clrscr();
for(a=0;a%26lt;24;a++)
for(b=0;b%26lt;79;b++)
printf("%c",z); //for filling the screen.
while(!kbhit())
{
for(r = 0; r%26lt;=24; r++)
{
for(c = 0; c%26lt;=79; c++)
{
s = 0xB8000000 + r*160 + c*2;
if(*s %26gt;= 'A' %26amp;%26amp; *s %26lt;= 'Z')
*s = *s+32;
else
{
if(*s %26gt;= 'a' %26amp;%26amp; *s%26lt;='z')
*s = *s -32;
}
}
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment