Hi, how can I convert a string to ASCII code? I looked up examples in Google but they all use arrays and advance codes, I haven't learned arrays yet, can someone explain me how to convert it please?
length is a member function (that is why the . is used and the () are to indicate it is a function) of a string and when called returns the number of characters the string contains. http://www.cplusplus.com/reference/string/string/length/
the square braces grab a character at a given position in the string, basically the first character is memory position 0 and then if you put in any other number it will get the character with an offset from the start eg the second character would be index 1 since it is an offset of 1 from the first character. Alternatively you can do it using pointer notation. The square braces are known as "operator []" and is another function of the string class. http://www.cplusplus.com/reference/string/string/operator[]/