C++ Program to find length of a string

C++ Program to find length of a string

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

void main()
{
 clrscr();
 char a[30];
 int i;
 cout<<“Enter a string:”;
 gets(a);

 for(i=0;a[i]!=’’;++i);
 cout<<“nLenth of the sting ‘”<<a<<“‘ is “<<i;
 getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *