bug!

hey all!
what i've been trying too do is change the first alphabet of each word (in a text) to captal form.
then i wrote the code bellow; would u tell me why it doesnt run?! :(

--------------------------------------
int main()
{
char a[40];
cin.getline(a,40);
int i;
for(i=0;i<=strlen(a);i++)
{
if(a[i]==' ')
i++;
a[i]=char(a[i]-32);
while(a[i]!=' ')
i++;
}
for(i=0;i<=strlen(a);i++)
cout<<a[i];

getch();
return 0;
}
You need to include proper libraries before your code. So enter this before int main()

1
2
3
4
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;


Hope this helps!
there is no need to is namespace std
i didnt know about <stdio.h>
and it worked!
i love you!!! :D
Topic archived. No new replies allowed.