#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
void decrypt(char a[],int n)
{
int i;
for(i=0;i<strlen(a);i++)
{
a[i]=a[i]-n;
}
}
void encrypt(char a[],int n)
{
int i;
for(i=0;i<strlen(a);i++)
{
a[i]=a[i]+n;
}
}
void main()
{
char name[100];
clrscr();
cout<<"enter a string\n";
// cin>>name;
gets(name);
cout<<"original string:"<<name<<"\n";
encrypt(name,4);
cout<<"encrypted string:"<<name<<"\n";
decrypt(name,4);
cout<<"decrypted string:"<<name<<"\n";
getch();
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
void decrypt(char a[],int n)
{
int i;
for(i=0;i<strlen(a);i++)
{
a[i]=a[i]-n;
}
}
void encrypt(char a[],int n)
{
int i;
for(i=0;i<strlen(a);i++)
{
a[i]=a[i]+n;
}
}
void main()
{
char name[100];
clrscr();
cout<<"enter a string\n";
// cin>>name;
gets(name);
cout<<"original string:"<<name<<"\n";
encrypt(name,4);
cout<<"encrypted string:"<<name<<"\n";
decrypt(name,4);
cout<<"decrypted string:"<<name<<"\n";
getch();
}
No comments:
Post a Comment