This is the code just trying to output the first number of a sequence.
but when i input1 1
,finish with crtl+d the output is 1D
.When I input-1 -1
finish with crtl+d the output is-1
without a wierd 'D'.
Why will that D shows up. I think the code is right and it maybe some update in terminal or g++ that cause the problem. Is anyone has some other ideas?
P.S. I use g++ to compile and it works good on teacher's unix platform. The code is following:
#include <iostream>
#include <cstdlib>
#include <vector>
std::vector <int> N;
int main(int argc, const char * argv[]) {
int tok;
while (std::cin >> tok){N.push_back(tok);}
std::cout << N[0]<<std::endl;
return 0;
}