0

Write a program that reads a string of characters and changes the firt letter of each word to uppercase

help me??

10th Jun 2018, 7:56 PM
Jose Luis Perales
Jose Luis Perales - avatar
6 Antworten
+ 6
Please show us your attempt.
10th Jun 2018, 8:06 PM
A Fox
A Fox - avatar
+ 6
You're welcome 🍕
10th Jun 2018, 8:56 PM
A Fox
A Fox - avatar
+ 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
10th Jun 2018, 8:29 PM
A Fox
A Fox - avatar
+ 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]); } }
10th Jun 2018, 8:23 PM
Jose Luis Perales
Jose Luis Perales - avatar
+ 1
thanks :)!!
10th Jun 2018, 8:54 PM
Jose Luis Perales
Jose Luis Perales - avatar
0
this program returns all the capital letters of the word I want only the first letter, thanks :)
10th Jun 2018, 8:24 PM
Jose Luis Perales
Jose Luis Perales - avatar