sahajjain01

Find length of a string.

Sep 13th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. //Program to find length of a string.
  2. #include<conio.h>
  3. #include<iostream.h>
  4. #include<stdio.h>
  5.  
  6. void main()
  7. {
  8.     clrscr();
  9.     char a[80];
  10.     cout<<"Enter a string: ";
  11.     gets(a);
  12.     for(int i=0;a[i]!='\0';i++);
  13.     cout<<"The length of the string is: "<<i;
  14.     getch();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment