#include <iostream>
#include <fstream>
#include <vector>
#include <limits>
#include <stdexcept>
using namespace std;
int main(){
ifstream in("values");
if(!in)
throw runtime_error("File \'values\' was not properly opened!");
vector<int> v;
int x = 0;
while( !(in >> x).eof() ){
if( !in.fail() )
v.push_back(x);
else{
cout << "Invalid input\n";
in.clear();
in.ignore(numeric_limits<streamsize>::max(), ' ');
}
}
for(int val : v)
cout << val << ", ";
}
5 7 23 16 81 v 1474 119 21 29 5 88*