char data type is a small int whose value is between -126 and 127. So do do what you want just loop through the array and add 1 to the char value.
char str[] = "Hi blah blah";
// add 1 to the first character, syntax is idental to int
++str[0];
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
after reading the string from a text file to the encryption like I posted earlier. Do you know how to read files ? In c++ use the ifstream class to read a text file. Here is an example of how to read/write text files.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Well, this isn't really encryption, but I can't really figure out what you're trying to do to obtain the numbers. This just prints out the ASCII value for each character by casting to int.
int i = 0;
while(myString[i]) {
std::cout << static_cast<int>(myString[i]) << " ";
i++;
}
std::cout << std::endl;
This code is fairly clear; it is trivial to modify it to fit into your read() function.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
at line 42 add another loop to encrypt the line as suggested earlier then output the result to the screen as illustrated by joe.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343