diff --git a/Capitalize_First_Letter_of_All_Words.cpp b/Capitalize_First_Letter_of_All_Words.cpp new file mode 100644 index 00000000..366818d3 --- /dev/null +++ b/Capitalize_First_Letter_of_All_Words.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +using namespace std; +int main() +{ + char str[200], ch; + int len, i, asc_val; + cout<<"Enter the String: "; + gets(str); + len = strlen(str); + for(i=0; i=97 && asc_val<=122) + { + asc_val = asc_val-32; + ch = asc_val; + str[i] = ch; + } + } + if(ch==' ') + { + ch = str[i+1]; + asc_val = ch; + if(asc_val>=97 && asc_val<=122) + { + asc_val = asc_val-32; + ch = asc_val; + str[i+1] = ch; + } + } + } + cout<<"\nAll words are capitalized successfully!"; + cout<<"\nThe new string is:\n\n"; + cout<