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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!