#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
void RemoveSpaces (char *str);
void Removevowels (char *str);
int main()
{
system("Color 1A");
char myString[300];
char clear[300];
char cipher[300];
int selection;
int x = 0;
int i = 0;
int opt;
cout<<"Enter a string!"<<endl;
cin.ignore();
cin.getline(myString,sizeof(myString));
cout<<"Plase select what you want to do:"<<endl;
cout<<"\t1) Encrypt"<<endl;
cout<<"\t2) Decrypt"<<endl;
cout<<"\t3) Decrypt"<<endl;
cout<<"\t4) Decrypt"<<endl;
cin>>selection;
if (selection==1)
Encrypt(myString);
cout<<"Your string is now:"<<myString<<endl;
else (selection==2)
Encrypt and remove space(myString);
cout<<"Your string is now:"<<myString<<endl;
else (selection==3)
Encryptand remove space and vawels(myString);
cout<<"Your string is now:"<<myString<<endl;
else (selection==4)
Decrypt your password(myString);
cout<<"Your string is now:"<<myString<<endl;
return 0;
}
x = strlen(clear);
// Encryption
for(i=0; i<=x-1; i++)
{
if (isspace(clear[i]))
{
cipher[i] = clear[i];
}
else
{
cipher[i] = clear[i]+3;
}
}
// Decryption
for(i=0; i<=x-1; i++)
{
if (isspace(cipher[i]))
{
clear[i] = cipher[i];
}
else
{
clear[i] = cipher[i]-3;
}
cout<<cipher[i]<<endl;
RemoveVowels(clear);
cin.get();
return 0;
}
void RemoveSpaces(char *str)//char * is basically the same as char[]
{
for (int i=0; str[i]; ++i)//loop until we hit the null character (str[i]==0)
{
if (str[i]==' ')//its a space!
str[i]=' '+3;//or whatever you set it to
}
}
void RemoveVowels(char clear[],char cipher[],int x,int i)
{
for(i=0;i<=x-1;i++)
{
if (cipher[i]=='a' || cipher[i]=='e' || cipher[i]=='i' || cipher[i]=='o' || cipher[i]=='u' || cipher[i]=='A' || cipher[i]=='E' || cipher[i]=='I' || cipher[i]=='O' || cipher[i]=='U') {
cipher[i]=' ';
}
cout<<cipher[i];
}
}
cout<<" Encrypted:" << cipher << endl;
cout<<" Decrypted:" << clear << endl;
system("pause");
return 0;
}
dont know what is going on with this code to many error comes out
help...