Files
CoursCPP/TP7/getio.cpp

47 lines
726 B
C++

#include "getio.h"
#include <string>
#include <vector>
using namespace std;
void getfloat(ifstream& s, float& f, const char sep) {
s >> f;
s.ignore();
}
void getint(ifstream& s, int& f, const char sep) {
s >> f;
s.ignore();
}
/*void getfloat(ifstream& s, float& f, const char sep) {
string tmp;
getline(s, tmp, sep);
if (tmp == "N/R" || tmp.empty())
return;
tmp.erase(remove(tmp.begin(), tmp.end(), '.'), tmp.end());
auto it = tmp.begin();
while (it != tmp.end() && *it != ',')
it++;
if (it != tmp.end()) {
*it = '.';
}
f = stof(tmp);
}*/
/*void getint(ifstream& s, int& f, const char sep) {
string tmp;
getline(s, tmp, sep);
if (tmp == "N/R" || tmp.empty())
return;
f = stoi(tmp);
}*/