Get length of string as integer
I have an input file that has data in for format:
so its an integer followed by a group of characters. I need to figure out how many characters there are. Then access them one at a time to compare them. I tried to save them to a string and check, like so:
but I get a warning because the string.length() function returns an unsigned integer. I need to use the length later as an int. Is there a good way to do what I need. Thanks!
int number, len;
cin >> number >> letters;
len = letters.length();