- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
To find the length of the string in C++ programming, you have to ask to the user to enter the string and then find the length the that string using function strlen() of string.h library and display the length value of the string on the output screen as shown here in the following program.
Source Code: Find Length of String
/* C++ Program - Find Length of String */ #include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> void main() { clrscr(); char str[20]; int len; cout<<"Enter a string : "; gets(str); len=strlen(str); cout<<"Length of the string is "<<len; getch(); }Output
Enter a string :blazingminds Length of the string is 11