Image

Imagespryiite wrote in Imagecpp

cryptography

hey hey hey. Thanks for everyones' help recently, andddd I have another question.

I'm trying to get my program to execute, and it won't work. It's supposed to be the one that encrypts, one that I mentioned earlier, where the ascii value goes up by one. (apple --> bqqmf) I can't figure out the error.


//to encrypt a string

#include
[Error: Irreparable invalid markup ('<iostream [...] (string1,>') in entry. Owner must fix manually. Raw contents below.]

hey hey hey. Thanks for everyones' help recently, andddd I have another question.

I'm trying to get my program to execute, and it won't work. It's supposed to be the one that encrypts, one that I mentioned earlier, where the ascii value goes up by one. (apple --> bqqmf) I can't figure out the error.

<lj-cut text="encrypting program">
//to encrypt a string

#include <iostream
#include <iomanip
#include <string

int main ()
{

char string1[10]; //character array to hold first string
char stringadd[10]; //character array that will be string 1 plus ASCII value

int i=0; //holds the string length
int null_length =0;
int end_string=0;
int k=0;
int p;
strcpy (string1, ""); //makes character arrays empty
strcpy (stringadd, "";

cout<< "This program will encrypt what you type. Please enter a string of text that is 10 digits or less!" << '\n';
cin >> string1;

while (string1[i] != stringadd[i])
{
string1[i]=stringadd[i];
i++;
}
p=i;
i=i-1;

while (string1[i]!= stringadd[i])
{
stringadd[i]=string1[i]+1;
i++;
cout << stringadd << endl;
}

cout << "Your string encrypted is: " << stringadd << endl;
return 0;
}

</lj-cut>