fork download
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main(){
  8.  
  9. int x, y;
  10. int ile;
  11.  
  12. ifstream odczyt("PARY_LICZB.txt");
  13. if (!odczyt) {
  14. cout<<"Błąd odczytu";
  15. return 0;
  16. }
  17.  
  18. ofstream zapis("ZADANIE5.txt");
  19.  
  20. if (!zapis) {
  21. cout<<"Błąd zapisu";
  22. }
  23.  
  24. for (int i = 0; i<1000; i++) {
  25. odczyt>>x>>y;
  26. if (x%y == 0 || y%x == 0) {
  27. ile++;
  28. }
  29. cout<<x<<" "<<y<<endl;
  30. zapis<<x<<" "<<y<<endl;
  31.  
  32. }
  33. cout<<endl<<"Jest tyle samych: "<<ile;
  34.  
  35. odczyt.close();
  36. zapis.close();
  37.  
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
Błąd odczytu