Guys i really need some help here with this function, in my program i enter string to to encrypt. from my function i want to delete all spaces, i'm really having problems here hope someone can tell me were im going wrong. thanks again.
#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
void RemovedSpaces(char *str);
int main()
{
char clear[256];
char cipher[256];
char myString[256];
int x,i;
int opt;
cout<<"Encryption (1) 0r Decryption (2):"<<endl;
cin>>opt;
cin.ignore();
if(opt==1)
{
cout<<" Enter a string(sentence):";
cin.getline(clear,sizeof(clear));
x = strlen(clear);
for(i=0;i<=x-1;i++)
{
cipher[i] = clear[i]+3;
}
cipher[x] = '\0';
cout<<" Encrypted:"<< cipher << endl;
}
for(i=0; i<=x-1; i++)
{
if (isspace(clear[i]))
{
cipher[i] = clear[i];
}
else
{
cipher[i] = clear[i]+3;
}
cout<<cipher[i]<<endl;
}
cin.get();
return 0;
}
void RemovedSpaces(char *str) {
for (int i=0; cipher[i]; ++i)
{ // Need to remove spaces from cipher[i]
if (cipher[i]!=' ')
}
cout<<cipher[i];
}