#include <iostream>
#include <fstream>
struct Example {
float x, y;
};
int main(void)
{
Example ex = { 0,0 };
std::ifstream ifs;
ifs.open("data.txt");
if ( !ifs ) {
std::cout << "error opening file";
exit(1);
}
ifs >> ex.x >> ex.y;
ifs.close();
std::cout << ex.x << ", " << ex.y << "\n";
}
// data.txt
// --------
// 3.14 17.25
/*
run:
3.14, 17.25
*/