diff --git a/brute.cc b/brute.cc index 6785227..f663e2a 100644 --- a/brute.cc +++ b/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; diff --git a/shift.cc b/shift.cc index d7e2ee7..c4694c8 100644 --- a/shift.cc +++ b/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; diff --git a/vigenere.cc b/vigenere.cc index 9bdc885..c726269 100644 --- a/vigenere.cc +++ b/vigenere.cc @@ -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;