Does anyone know a way to get the length of a string? I have tried:
str.length
str.size
strlen()
Bob
Code:// Exercise in string manipulation #include <iostream> #include <string> void prtname(std::string str); using namespace std; int main() { string input; cout << "Please enter the name of a bird with long legs: "; cin >> input; prtname(input); return 0; } void prtname(std::string str) { cout << "The birds name is: " << str; cout << "The lenght of the name is: " << str.length; }