Home
Welcome To Programming Page Of 2k1CP
Here are given some very useful
programs prepared by our team. They are very helpful in understanding C++.
PROGRAM # 1
This is most interesting but Dangerous
program because through its .EXE file ,password can be applied on Windows.
This program Deals with strings &
produces Password application.
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<string.h>
void main(void)
{
clrscr();
int j;
char *name="andy";
char argu[80];
do
{ cout<<"\n\n\n\t\t\t\t****************";
cout<<"\n\t\t\t\t Enter Password\n";
cout<<"\t\t\t\t****************\n\t\t\t\t";
cin>>argu;
clrscr();
if(strcmp(name,argu)==0)
break;
cout<<"Invalid password.\n ";
}
while(j!=0);
cout<<"\n\n\t\tYou have successfully entered in to Windows.\n\n\t\t\tPress any
key to continue.\n";
getch(); }
PROGRAM # 2
This program is about ENCRYPTION
& DECRYPTION.
Entered
number is encrypted a/c to a special formula & then Decrypted no. original
entered )
number is achieved.
#include<iostream.h>
#include<conio.h>
int encrypt(int);
int decrypt(int);
void main(void)
{ clrscr();
int n;
cout<<"enter the number you want to encrypt=";
cin>>n;
int encry=encrypt(n);
cout<<"Encrypted number is="<<encry;
int decry=decrypt(encry);
cout<<"\nDecrypted or Original number is="<<decry;
}
int encrypt(int n)
{
int i,j,k,l,num;
i=n/1000;
j=(n-i*1000)/100;
k=(n-i*1000-j*100)/10;
l=(n-i*1000-j*100-k*10);
i=(i+7)%10;
j=(j+7)%10;
k=(k+7)%10;
l=(l+7)%10;
num=k*1000+l*100+i*10+j;
return num;
}
int decrypt(int n)
{
int i,j,k,l,num;
i=n/1000;
j=(n-i*1000)/100;
k=(n-i*1000-j*100)/10;
l=(n-i*1000-j*100-k*10);
i=(i+3)%10;
j=(j+3)%10;
k=(k+3)%10;
l=(l+3)%10;
num=k*1000+l*100+i*10+j;
return num;
}
Have any questions or suggestion, contact us on: -
[email protected]
©2001.All rights
reserved by
www.2k1cp.com