This is a Cpp Program to find the length of a String. |
PROGRAM :
#include <iostream> #include <string.h> using namespace std; int main() { char name[40]; cout << "Enter any name(String) : \t"; cin.get(name , 40); cout << "\nThe length of the string you entered is : \t" << strlen(name) << endl; return 0; }
OUTPUT :
Cpp Program - Length of a string |