Counting Characters and Lines from a textile in C++

This program is able to open a file and count how many lines a how many characters exist in that file, to make this work the first thing is open a file which is done in this part:

datafile.open(filename);
while(getline(datafile,linea)){
lnstep++;
charCount += linea.length();
}

also that part is in charge of counting the characters and lines. Basically there is where everything happens and the other part of the code is for ask the input of file name, closing the file, printing, etc.

Hope this is useful for you.

Screen Shot 2017-10-25 at 2.58.30 PM

And here is my code:

https://github.com/getorres99/TC1017-Fall-IMT-GTO/blob/master/WSQ9.cpp

Sources:

I needed to look for information about opening and manipulating text files in C++, i found some useful stuff here: http://www.cplusplus.com/forum/beginner/8388/

and in this video:

The normal consult book: “How to Think Like a Computer Scientist, C++ Version”, Downey, Allen B. 2012.

https://www.programiz.com/cpp-programming/examples/standard-deviation

#WSQ09#teclife

Deja un comentario