cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
bug!
bug!
Jun 10, 2015 at 6:05pm UTC
pardi
(6)
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;
}
Jun 10, 2015 at 10:05pm UTC
newbiee999
(112)
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!
Jun 11, 2015 at 12:11pm UTC
AssignmentExpert
(16)
there is no need to is namespace std
Jun 12, 2015 at 7:33am UTC
pardi
(6)
i didnt know about <stdio.h>
and it worked!
i love you!!! :D
Topic archived. No new replies allowed.