strlen

Dec 5, 2010 at 5:41am
i have a program that designed to count the characters,but whenever i put space on it, it only counts the character before the space.. how can i resolve this??
Dec 5, 2010 at 5:53am
you share with us your code.

size_t strlen ( const char * str );
Dec 5, 2010 at 5:59am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string.h>
#include <iostream.h>
#include <conio.h>
using namespace std;
main ()
{
  char input1[40];
  char input2[40];
  cin>>input1;a
    cout<<"\n";
    cout<<strlen(input1);
    getch ();          
  return 0;
}


Dec 5, 2010 at 6:36am
1
2
3
4
5
6
7
8
9
10
int main ()
{
  char input1[40];
  char input2[40];
  gets(input1);
    cout << input1 << "\n";
    cout<<strlen(input1);
    getch ();          
  return 0;
}
Dec 6, 2010 at 1:57am
what is the used of gets in this program???
Dec 6, 2010 at 2:00am
thanks for the help. :))
Dec 6, 2010 at 6:48pm
It does not matter....
Topic archived. No new replies allowed.