{"id":38513,"date":"2016-05-14T10:49:13","date_gmt":"2016-05-14T15:49:13","guid":{"rendered":"http:\/\/lilihecblog.wordpress.com\/?p=117"},"modified":"2016-05-15T07:35:20","modified_gmt":"2016-05-15T12:35:20","slug":"wsq12-word-count-10","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/05\/wsq12-word-count-10\/","title":{"rendered":"#WSQ12-Word count"},"content":{"rendered":"<p>Este programa me gusto, aunque no funciona como deber\u00eda capilla pero no muestra ninguna resultado aun as\u00ed dejo el c\u00f3digo:<\/p>\n<p>#include &lt;iostream&gt;<br \/>\n#include &lt;string&gt;<br \/>\n#include &lt;fstream&gt;<br \/>\nusing namespace std;<br \/>\nint find_word(string word, string tipo){<br \/>\nstring line;<br \/>\nint cont=0;<br \/>\nifstream myfile(tipo);<br \/>\nif (myfile.is_open()){<\/p>\n<p>while ( getline (myfile,line) ){<br \/>\nif(\u2018line\u2019 == \u2018word\u2019){<br \/>\ncont=cont+1;<br \/>\n}<br \/>\n\/\/ cout &lt;&lt; line &lt;&lt; endl;<br \/>\n}<br \/>\nmyfile.close();<br \/>\n}<br \/>\nelse {<br \/>\ncout&lt;&lt;\u201cCANNOT OPEN THE FILE\u201d&lt;&lt;endl;<br \/>\n}<br \/>\ncout&lt;&lt;\u201cThe word\u2026\u201d&lt;&lt;word&lt;&lt;\u201c\u2026 is used \u201c&lt;&lt;cont&lt;&lt;\u201d times.\u201d&lt;&lt;endl;<br \/>\nreturn cont;<br \/>\n}<\/p>\n<p>int main(int argc, char const *argv[]) {<br \/>\nstring word, tipo;<br \/>\nint cont;<br \/>\nstd::cout &lt;&lt; \u201cPlease type the word you want to search.\u201d &lt;&lt; std::endl;<br \/>\nstd::cin &gt;&gt; word;<br \/>\nstd::cout &lt;&lt; \u201cPlease enter the name of the file to search the word\u201d &lt;&lt; std::endl;<br \/>\nstd::cin &gt;&gt; tipo;<br \/>\nfind_word(word, tipo);<br \/>\nreturn 0;<br \/>\n}<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-123\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/05\/6034dda0cc7405f2b7c4b4849a892e69.jpg\" alt=\"Captura de pantalla 2016-05-14 a las 10.48.52.png\"   \/><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/lilihecblog.wordpress.com\/117\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/05\/70ee3b9719ef1840fec8c065fabf766d.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/05\/07a0110baed0fc89308d5fe5656023b4.jpg#038;blog=105581831&#038;%23038;post=117&#038;%23038;subd=lilihecblog&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Este programa me gusto, aunque no funciona como deber\u00eda capilla pero no muestra ninguna resultado aun as\u00ed dejo el c\u00f3digo: #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;fstream&gt; using namespace std; int find_word(string word, string tipo){ string line; int cont=0; ifstream myfile(tipo); if (myfile.is_open()){ while ( getline (myfile,line) ){ if(\u2018line\u2019 == \u2018word\u2019){ cont=cont+1; } \/\/ cout &lt;&lt; &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/05\/wsq12-word-count-10\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">#WSQ12-Word count<\/span><\/a><\/p>\n","protected":false},"author":77,"featured_media":38563,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[45],"class_list":["post-38513","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-sin-categoria"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/38513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=38513"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/38513\/revisions"}],"predecessor-version":[{"id":38567,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/38513\/revisions\/38567"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/38563"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=38513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=38513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=38513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}