Skip to content

Instantly share code, notes, and snippets.

@Matslom
Created January 20, 2019 19:58
Show Gist options
  • Save Matslom/ef47e1517d0ba9f2a3eec1e15e561513 to your computer and use it in GitHub Desktop.
Save Matslom/ef47e1517d0ba9f2a3eec1e15e561513 to your computer and use it in GitHub Desktop.
void rozdziel(char* plik, char* wynik1, char* wynik2, double wartosc) {
std::ifstream input;
std::ofstream lower, higher;
input.open(plik);
lower.open(wynik1);
higher.open(wynik2);
if (!input.good() || !lower.good() || !higher.good()) {
std::cout << "Blad podczas otwarcia plikow";
return;
}
std::string name;
double price;
while (input >> name >> price) {
if (price < wartosc) {
lower << name << ' ' << price << std::endl;
} else {
higher << name << ' ' << price << std::endl;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment