#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#define LEN 4
template <class T>
T parse(const std::string& str) {
T temp;
std::istringstream iss(str);
iss >> temp;
if (iss.bad() || iss.fail()) {
std::cout << "istringstream error";
}
return temp;
}
int main() {
std::string foo[LEN] = {"97", "98", "99", "100"};
int arr[LEN];
std::transform(foo, foo + LEN, arr, parse<int>);
for (int i = 0; i < LEN; i++) {
std::cout << arr[i] << " ";
}
}
/*
run:
97 98 99 100
*/