The C++ library
<string>
doesn't have a
toupper() function, that is part of the C library
<cctype>
.
<string> might include
<cctype> in some implementations, but it isn't a requirement.
Working on an entire C string instead of individual characters makes for a more complex algorithm.
If that is your function prototype you are required to use, then a custom
toupper() function that works on an entire C string instead of a single
char might consist of the following steps:
1. determine the length of the C string by finding the terminating null ('\0'). If that fails, return an error the string is not valid. Unfortunately there is no method to indicate your C string has no null terminator with your function prototype. So you have to assume your C string is a proper C string.
2. loop through your valid C string. With each character determine if it is an alphabetic character that can be either upper or lower case.
2a. If not an alphabetic character (number or punctuation) go onto the next character in the string (hint,
continue
statement).
http://www.cplusplus.com/doc/tutorial/control/
2b. If it is an alphabetic character check if it is already upper-case. If so, next character. If not subtract 48 (x30 hex) from it to convert it from lower-case to upper. See ASCII code table.
http://www.cplusplus.com/doc/ascii/