From efcfdc46e7f719c6ca613a29473743197e4b6ebd Mon Sep 17 00:00:00 2001 From: Raushan Singh <88944944+raushan2409@users.noreply.github.com> Date: Thu, 13 Oct 2022 20:22:51 +0530 Subject: [PATCH] Create Capitalize_First_Letter_of_All_Words.cpp #hactoberfest2022 --- Capitalize_First_Letter_of_All_Words.cpp | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Capitalize_First_Letter_of_All_Words.cpp 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<