Not getting any output. First time using filestream in C++ -


I am writing a program that uses the flystream and when I run it I am not getting any output

Here's the code:

  Add # & lt; Iostream & gt; #include & lt; string & gt; #to & lt include, fstream & gt; #to & lt include, cctype & gt; using namespace std; Int main () {string word, search, inputfilename, outputfilename; Easiest stream; Int wordcount = 0; Int charcount = 0; Cout & lt; & Lt; "Enter input filename" & lt; & Lt; Endl; Cin & gt; & Gt; Inputfilename; Inf.open (inputfilename.c_str ()); Cout & lt; & Lt; "Enter search string" & lt; & Lt; Endl; Cin & gt; & Gt; Search; Inf & gt; & Gt; word; While (inf) {wordcount ++; } Inf.close (); Cout & lt; & Lt; "Word:" & lt; & Lt; Password & lt; & Lt; Endl; Return 0; }   

The input file I am using is just a paragraph, in which there are some sentences.

I'm not sure what is wrong in my code so far, help is appreciated.

You've got an infinite loop: try it:

  while (inf & Gt; & gt; word) {wordcount ++; }    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -