English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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.

2007-02-19 05:22:57 · 1 answers · asked by mahendran d 2 in Computers & Internet Programming & Design

1 answers

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
#include
void main()
{
int a,b,i,r,c,ch;
char z='a';
char far *s;
clrscr();

for(a=0;a<24;a++)
for(b=0;b<79;b++)
printf("%c",z); //for filling the screen.

while(!kbhit())
{
for(r = 0; r<=24; r++)
{
for(c = 0; c<=79; c++)
{
s = 0xB8000000 + r*160 + c*2;
if(*s >= 'A' && *s <= 'Z')
*s = *s+32;
else
{
if(*s >= 'a' && *s<='z')
*s = *s -32;
}
}
}
}
}

2007-02-22 06:07:25 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers