Question: I'm trying to create a function that counts the number of characters on names, then prints out a message based on the number of characters.
I'm trying to create a function that counts the number of characters on names, then prints out a message based on the number of characters. the function must be outside the main function. #include #include #include using std::cout; using std::endl; using std::cin; using std::string; using std::vector; string lenght() { string input; if (input.length()<5){ cout << "Your name is too short with only " << input.length ()<< endl; } return " "; } int main() { cout << "Enter your name: "<< endl; string input; cin >> input; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
