-
-
Save Matslom/ef47e1517d0ba9f2a3eec1e15e561513 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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