Assuming that each element in the input file separated by whitespaces, you can just do this:
1 2 3 4 5
std::ifstream input("input.txt");
char c;
int arr[3];
// stops reading each element after a whitespace
input >> c >> arr[0] >> c >> arr[1] >> c >> arr[2];
- Exactly the same as you would with std::cin.
1 2 3 4
std::cout << "Enter an expression:\n";
char op;
int x, y;
std::cin >> x >> op >> y;