From 0ff6ad9ce77eabd44e40ba26c4d90c9861fe8d20 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Mon, 14 May 2018 21:49:32 -0400 Subject: [PATCH] Fixed bug that would give invalid results with large offset --- SourceFiles/Caesar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SourceFiles/Caesar.cpp b/SourceFiles/Caesar.cpp index bde50f0..7f181ab 100644 --- a/SourceFiles/Caesar.cpp +++ b/SourceFiles/Caesar.cpp @@ -78,7 +78,7 @@ std::string Caesar::getOutputString() const{ * @return The encoded message (outputString) */ std::string Caesar::encode(){ - char temp; //A temperary holder for the current working character + unsigned char temp; //A temperary holder for the current working character for(unsigned int cnt = 0;cnt < inputString.size();++cnt){ temp = inputString.at(cnt); //If it is a upper case letter shift it and wrap if necessary @@ -130,7 +130,7 @@ std::string Caesar::encode(int shiftAmount, std::string input){ * @return The decoded message (outputString) */ std::string Caesar::decode(){ - char temp; + unsigned char temp; for(unsigned int cnt = 0;cnt < inputString.size();++cnt){ temp = inputString.at(cnt); //If it is an upper case letter shift it and wrap if necessary