0
Write a program that reads a string of characters and changes the firt letter of each word to uppercase
help me??
6 Answers
+ 6
Please show us your attempt.
+ 6
You're welcome đ
+ 3
in the function capital you only need to write
s[0] = toupper(s[0]);
this will change only the first letter to uppercase :)
Also, you don't need a newline after each word
+ 1
#include <iostream>
using namespace std;
void capital(string &s);
int main() {
string c;
cout<<"enter the capital word :";
cin>>c;
cout<<c<<endl;
cout<<"length of the word :"<<c.length()<<endl;
capital(c);
for(int i=0; i<c.length(); i++){
cout << c[i]<<endl;
}
return 0;
}
void capital(string &s)
{
for(int i=0; i<s.length(); i++){
s[i]=toupper(s[i]);
}
}
+ 1
thanks :)!!
0
this program returns all the capital letters of the word I want only the first letter, thanks :)