#include <iostream.h>
#include <conio.h>
#include<stdio.h>
char line[40] ;
int calculate_length ( ) ;
void main ()
{
int length ;
cout <<" Enter a string : " ;
gets(line) ;
length = calculate_length ( ) ;
cout<<" \nThe string length is "<<length ;
getch ( ) ;
}
int calculate_length ( )
{
int count = 0 ;
while (line[count] != '\0')
count++ ;
return (count) ;
}
0 comments:
Post a Comment