adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C++ to find the length of string using user define function

Program in C++ to find the length of string using user define function 



#include<iostream>
#include<string.h>
#include<conio.h>
 using namespace std;
    int StrLen(char *str)
  {
   int i;
   for(i=0;str[i]!='\0';i++);
     return i;
  } 

  int main()
  {
   char str1[100];
   cout<<"Enter string :-";
   cin.getline(str1,99);
   cout<<"Length of string ="<<StrLen(str1);
   getch();
  }
Output:-









Related Programs --

  1. Program in C++ to copy one word into another word
  2. Program in C++ to add two string
  3. Program in C++ to convert string Uppercase to Lowercase
  4. Program in C++ to convert string  Lowercase to Uppercase 
  5. Program in C++ to compare two string
  6. Program in C++ to count words in given sentence

Post a Comment

0 Comments