Fixed warning about comparing signed and unsigned integer types

This commit is contained in:
2018-05-13 22:26:42 -04:00
parent 0cfe5e40bd
commit 90dcd3412c
5 changed files with 18 additions and 18 deletions

View File

@@ -29,7 +29,7 @@ Atbash::~Atbash(){
*/
void Atbash::setInputString(std::string input){
//Strip all punctuation and whitespace from input and make all letters capital
for(int cnt = 0;cnt < input.size();++cnt){
for(unsigned int cnt = 0;cnt < input.size();++cnt){
char letter = input[cnt];
//If it is upper case add it to the inputString
if(isupper(letter)){
@@ -68,7 +68,7 @@ std::string Atbash::getOutputString() const{
*/
std::string Atbash::encode(){
//Step through every element in the inputString and shift it the correct amount
for(int cnt = 0;cnt < inputString.size();++cnt){
for(unsigned int cnt = 0;cnt < inputString.size();++cnt){
outputString += (inputString[cnt] + 25 - (2 * (inputString[cnt] - 'A')));
}
@@ -94,7 +94,7 @@ std::string Atbash::encode(std::string input){
* @return The decoded inputString (outputString)
*/
std::string Atbash::decode(){
for(int cnt = 0;cnt < inputString.size();++cnt){
for(unsigned int cnt = 0;cnt < inputString.size();++cnt){
outputString += (inputString[cnt] + 25 - (2 * (inputString[cnt] - 'A')));
}