#include <string>
#include <vector>
#include <iostream>
#include <sstream>

int main()
{
	std::vector<int> numbers;
	std::string line;
	
    // ifstream myfile ("example.dat");
	std::istringstream myfile(
		"3\n"
		"12\n"
		"23\n"
		"34\n"
		"12 34\n"
		"12 12\n"
		"34 23\n"
		"23 23\n\n"
	);

	while ( std::getline(myfile, line) )
	{
		try {
			int num = std::stoi(line) ;
			std::cout << "Converted \"" << line << "\" to " << num << '\n' ;
		}
		catch( std::exception& ex)
		{
			std::cout << "ERROR: " << ex.what() << '\n' ;
			std::cout << "\tUnable to convert \"" << line << "\" to a number.\n" ;
		}
	}
}