Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- bool podzielnosc (int liczba){
- int suma=0;
- while (liczba>0){
- suma=liczba%10;
- if (suma==0 || suma==5) return true;
- return false;
- }
- }
- int main(int argc, char *argv[])
- {
- fstream dane, wynik;
- dane.open ("dane.txt", ios::in);
- wynik.open ("wynik.txt", ios::out);
- int n;
- while (!dane.eof()){
- dane>>n;
- if (podzielnosc(n)==true)wynik<<n<<endl;
- }
- dane.close ();
- wynik.close();
- system ("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement