#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
int main()
{
std::string line;;
std::ifstream inFile("input.txt");
std::vector<int> vec;
if(inFile)
{
int i = 0;//this variable will be used to add element into the vector
while(getline(inFile, line, '\n'))
{
std::istringstream s(line);
while(s >> i || !s.eof()) {
if(s.fail())
{
s.clear();
std::string temp;
s >> temp;
continue;
}
else
{
vec.push_back(i);
}
}
}
}
else
{
std::cout<<"file could not be read"<<std::endl;
}
inFile.close();
for(int i: vec)
{
std::cout<<"elem: "<<i<<std::endl;
}
return 0;
}
1 2 5 65 87 43
465
76 242 778 34
rt 43 y 42