//Sam Trivikraman CS1A Chapter 10, p. 588, #1
//
/*
******************************************************************************
Calculate the length of a string
_______________________________________________________________________________
This program counts and displays the length of a string.
_______________________________________________________________________________
INPUT
the string of words : The user inputted string
OUTPUT
string length : The length of the string
_______________________________________________________________________________
*******************************************************************************
*/
#include <iostream>
#include <cstring>
using namespace std;
//function that calculates the length of the string
int length(string str)
{
int len; //OUTPUT The length of the string
//Calculate the length of the string
len = str.length();
//return the length of the string
return len;
}
int main() {
string word; //INPUT The user inputted string
//ask the user for a string
cout << "Please enter a string. " << endl;
cin >> word;
//Call the string length function and output the length of the string
cout << "The length of the string is: " << length(word) << endl;
return 0;
}