In This Program you can use standard library function strlen() to find the length of a string but, this program computes the length of a string manually without using strlen() funtion.
Source Code to Calculate Length of a string without using strlen() Function
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char s[1000],i;
cout << "Enter a string: ";
cin.getline(s, 1000);
for(i=0; s[i]!='\0'; ++i);
cout << "Length of string: " << i;
return 0;
}
Output
Enter a string: Programiz
Length of string: 9