Added exceptions for whitespace
This commit is contained in:
parent
75546a8619
commit
013c05f2dd
5
brute.cc
5
brute.cc
@ -5,6 +5,11 @@ void shift(char* text, int key)
|
||||
std::cout << key << ": ";
|
||||
for(int i = 0; text[i] != 0; ++i)
|
||||
{
|
||||
if(text[i] == ' ')
|
||||
{
|
||||
std::cout << ' ';
|
||||
continue;
|
||||
}
|
||||
char c = std::tolower(text[i])-key;
|
||||
if(c < 'a') c+=26;
|
||||
if(c > 'z') c-=26;
|
||||
|
5
shift.cc
5
shift.cc
@ -15,6 +15,11 @@ int main(int argc, char** argv)
|
||||
|
||||
for(int i = 0; text[i] != 0; ++i)
|
||||
{
|
||||
if(text[i] == ' ')
|
||||
{
|
||||
std::cout << ' ';
|
||||
continue;
|
||||
}
|
||||
char c = std::tolower(text[i])+key;
|
||||
if(c < 'a') c+=26;
|
||||
if(c > 'z') c-=26;
|
||||
|
@ -20,6 +20,11 @@ int main(int argc, char** argv)
|
||||
int ki = 0;
|
||||
for(int pi = 0; text[pi] != 0; ++pi)
|
||||
{
|
||||
if(text[i] == ' ')
|
||||
{
|
||||
std::cout << ' ';
|
||||
continue;
|
||||
}
|
||||
char c = std::tolower(text[pi]) + keyvalue(key[ki]);
|
||||
if(c < 'a') c+=26;
|
||||
if(c > 'z') c-=26;
|
||||
|
Loading…
Reference in New Issue
Block a user