{"id":14697,"date":"2024-05-20T22:03:25","date_gmt":"2024-05-20T19:03:25","guid":{"rendered":"https:\/\/elzero.org\/?p=14697"},"modified":"2024-05-20T22:03:25","modified_gmt":"2024-05-20T19:03:25","slug":"implement-functions-with-cpp-check-if-first-letter-is-capital","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/implement-functions-with-cpp-check-if-first-letter-is-capital\/","title":{"rendered":"Check If First Letter Is Capital"},"content":{"rendered":"<h3>\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062f\u0631\u0633<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-c\">\r\n#include <iostream>\r\nusing namespace std;\r\n\r\n\/*\r\n  Is First Letter Capital\r\n  \"Hello Elzero Web School\" -> True -> All Caps\r\n  \"Hello elzero Web School\" -> False -> elzero -> [e] Small\r\n*\/\r\n\r\nbool firstCapital(string st)\r\n{\r\n  bool allCaps = true;\r\n\r\n  for (int i = 0; i < st.length(); i++)\r\n  {\r\n    if (i == 0 &#038;&#038; !(st[i] >= 'A' && st[i] <= 'Z'))\r\n    {\r\n      allCaps = false;\r\n    }\r\n    else if (st[i] == ' ' &#038;&#038; !(st[i + 1] >= 'A' && st[i + 1] <= 'Z'))\r\n    {\r\n      allCaps = false;\r\n    }\r\n    if (!allCaps)\r\n    {\r\n      return false;\r\n    }\r\n  }\r\n\r\n  return allCaps;\r\n}\r\n\r\nint main()\r\n{\r\n  cout << firstCapital(\"Hello Elzero Web School\") << endl;\r\n  cout << firstCapital(\"Hello Elzero web\") << endl;\r\n  cout << firstCapital(\"HWWllo Elzero Web\") << endl;\r\n  return 0;\r\n}\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>\u0645\u062d\u062a\u0648\u0649 \u0627\u0644\u062f\u0631\u0633<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1454],"tags":[],"class_list":["post-14697","post","type-post","status-publish","format-standard","hentry","category-implement-functions-with-cpp"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/14697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=14697"}],"version-history":[{"count":1,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/14697\/revisions"}],"predecessor-version":[{"id":14698,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/14697\/revisions\/14698"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=14697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=14697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=14697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}