I'm trying to debug a fairly simple function that is suppose to take a string and convert any lowercase letters to uppercase. Unfortanitly I am getting a large number of errors I do not know how to fix (using codeblocks)
the code is as follows:
The main errors I am getting are:Code:/*
This function accepts a string and returns a string with any lowercase letters found in it to uppercase letters
@param inputString: This is the string to be converted
@return: The upperCase string
*/
string toUpper(string inputString)
{
for(int i=0; i<inputString.length(); i++)
{
if(inputString[i]=="a")
inputString[i]="A";
else if(inputString[i]=="b")
inputString[i]="B";
else if(inputString[i]=="c")
inputString[i]="C";
else if(inputString[i]=="d")
inputString[i]="D";
else if(inputString[i]=="e")
inputString[i]="E";
else if(inputString[i]=="f")
inputString[i]="F";
else if(inputString[i]=="g")
inputString[i]="G";
else if(inputString[i]=="h")
inputString[i]="H";
else if(inputString[i]=="i")
inputString[i]="I";
else if(inputString[i]=="j")
inputString[i]="J";
else if(inputString[i]=="k")
inputString[i]="K";
else if(inputString[i]=="l")
inputString[i]="L";
else if(inputString[i]=="m")
inputString[i]="M";
else if(inputString[i]=="n")
inputString[i]="N";
else if(inputString[i]=="o")
inputString[i]="O";
else if(inputString[i]=="p")
inputString[i]="P";
else if(inputString[i]=="q")
inputString[i]="Q";
else if(inputString[i]=="r")
inputString[i]="R";
else if(inputString[i]=="s")
inputString[i]="S";
else if(inputString[i]=="t")
inputString[i]="T";
else if(inputString[i]=="u")
inputString[i]="U";
else if(inputString[i]=="v")
inputString[i]="V";
else if(inputString[i]=="w")
inputString[i]="W";
else if(inputString[i]=="x")
inputString[i]="X";
else if(inputString[i]=="y")
inputString[i]="Y";
else if(inputString[i]=="z")
inputString[i]="Z";
}
}
/home/hewhosurvives/c++/order/item.h||In member function ‘bool item::load(std::ifstream&)’:|
/home/hewhosurvives/c++/order/item.h|101|warning: comparison between signed and unsigned integer expressions|
/home/hewhosurvives/c++/order/functions.h||In function ‘std::string toUpper(std::string)’:|
/home/hewhosurvives/c++/order/functions.h|21|warning: comparison between signed and unsigned integer expressions|
/home/hewhosurvives/c++/order/functions.h|23|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|23|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|24|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|25|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|25|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|26|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|27|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|27|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|28|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|29|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|29|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|30|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|31|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|31|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|32|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|33|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|33|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|34|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|35|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|35|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|36|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|37|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|37|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|38|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|39|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|39|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|40|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|41|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|41|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|42|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|43|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|43|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|44|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|45|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|45|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|46|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|47|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|47|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|48|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|49|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|49|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|50|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|51|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|51|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|52|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|53|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|53|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|54|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|55|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|55|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|56|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|57|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|57|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|58|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|59|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|59|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|60|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|61|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|61|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|62|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|63|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|63|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|64|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|65|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|65|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|66|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|67|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|67|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|68|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|69|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|69|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|70|error: invalid conversion from ‘const char*’ to ‘char’|
/home/hewhosurvives/c++/order/functions.h|71|warning: comparison with string literal results in unspecified behaviour|
/home/hewhosurvives/c++/order/functions.h|71|error: ISO C++ forbids comparison between pointer and integer|
/home/hewhosurvives/c++/order/functions.h|72|error: invalid conversion from ‘const char*’ to ‘char’|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 27 warnings ===|
Any ideas how I can fix it or what I am doing wrong?