Write a program c++ to find the length of string.


Write a program c++ to find the length of string.
Find the length of string in c++.

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
 
int main( )
{
        clrscr( );
        char str[80];
        cout<<"Enter a string:";
        gets(str);
 
        for(int i=0;str[i]!='\0';i++);
 
        cout<<"Lenght of string is :"<<i;
 
        getch();
        return 0;
}

No comments:

Post a Comment