I have been learning on my own. Can't really understand voids. The only thing I picked up from online really is that they don't return any vaule witch is kinda confusing on its own. But this code is just to make caps not matter in a program im trying to make to practice.
#include <iostream>
#include <cctype>
#include <string>
usingnamespace std;
void toUpper(string&);
void toLower(string&);
void toUpper(string& str)
{
for (unsigned i = 0; i < str.size(); i++)
{
str[i] = toupper(str[i]);
}
}
int main()
{
string lookup = "";
cout << "lookup test type htl";
cin >> lookup;
toUpper(lookup);
if (lookup == "HTL")
{
cout << "it worked\n";
}
else {cout << "fail\n"; }
}
I understand the looks (until the for loop) what I really dont understand is &str is it saying that str is short for string? I also don't understand the line inside the for loop. Really its just that whole for loop. I need to understand it before I put it in my main code so I dont mess up my main system