I have the following code:
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
    string file;
    cout << "Please enter input file name: ";
    cin >> file;
    int count[128] = {0};
    ifstream in(file.c_str());
    char one;
    cin >> noskipws;
    while(!in.eof()){
        in.get(one);
        count[static_cast<int>(one)]++;
        cout << one << " : " << static_cast<int>(one) << endl;
    }
}
For an input file of:
Hello.
Line 2
My program tells me that there are two 2's at the end of the file. Why is this? To be clear, this is what I output:
H : 72
e : 101
l : 108
l : 108
o : 111
. : 46
 : 10
L : 76
i : 105
n : 110
e : 101
  : 32
2 : 50
2 : 50
Which is what I want besides for the two 2's at the end.
 
    