C Program to check if mouse support is available or not
#include
#incude
#include
int initmouse();
union REGS i, o;
int main()
{
int flag;
flag = initmouse();
if (flag == 0)
{
printf("Mouse
support not available.");
}
else
{
printf("Mouse
support available.");
}
return 0;
}
int
initmouse()
{
i.x.ax = 0;
int86(0X33, &i, &o);
return (o.x.ax);
}
Output
Mouse support
available.
C Program to Hide Mouse Pointer
#include
#include
#include
void
showseptr();
void
hidemouseptr();
union
REGS I,o;
int
main()
{
int
count=1, gDriver=DETECT,gmode;
initgrphy(&gDriver,&gMode,
"c\\:tc\\bgi");
i.x.ax=0;
int86(0x33,&I,&o);
if(o.x.ax==0)
{
printf("\n Mouse support is unavailable!!
");
}
else
{
showmouseptr();
while(count<=10)
{
getch();
count++;
if(count%2==0)
hidemouseptr();
else
chowmouseptr();
}
}
getch();
return 0;
}
void showmouseptr()
{
i.x.ax=1;
int86(0x33,&I,&o);
}
void hidemouseptr()
{
i.x.ax=2;
int 86(0x33,&I,&o);
}
Temperature Conversion from Celsius to Fahrenheit
#include
#include
int
main()
{
float fahrenheit, celsius;
int lower, upper, step;
lower = 0;
upper = 200;
step = 20;
printf(" C\tF");
printf("\n------------");
celsius = lower;
while (celsius <= upper)
{
fahrenheit
= (9.0 / 5.0) * celsius + 32.0;
printf("\n%3.0f
%6.1f", celsius, fahrenheit);
celsius =
celsius + step;
}
return 0;
}
Output
C F
------------
0 32.0
20 68.0
40 104.0
60 140.0
80 176.0
100 212.0
120 248.0
140 284.0
160 320.0
180 356.0
200 392.0
C Program for Changing Backslash Character Arguments
#include
#include
int
main(int argc,char*argv[])
{
printf("\n Hello,
World\a");
printf("\n Hello,
World\b");
printf("\n Hello,
World\c");
printf("\n Hello,
World\d");
printf("\n Hello,
World\e");
getch();
}
Output
Hello ,
World
Hello ,
World
Hello ,
Worldc
Hello ,
Worldd
Hello ,
World
C Program for Temperature Conversion from Fahrenheit to Celsius
#include
#include
int
main()
{
float
fahrenheit,celsius;
int
lower,upper,step;
lower =0;
upper=200;
step=20;
printf("F\tC");
printf("\n============================”);
fahrenheit=lower;
while(Fahrenheit<=upper)
{
celsius=(5.0/9.0)*(fahrenhebit-32.0);
printf("\n %3 of %6. 1f",
Fahrenheit,Celsius);
fahrenheit=Fahrenheit+step;
}
return 0;
}
Output
F C
20 -6.7
40 4.4
60 15.6
80 26.7
100 37.8
120 48.9
140 60.0
160 71.1
180 82.2
200 93.3
No comments:
Post a Comment