Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. main()
  5. {
  6. ifstream fin("wyrazy.txt");
  7. int wynik=1;
  8. string tekst;
  9. while(!fin.eof())
  10. {
  11. getline(fin,tekst);
  12. if(tekst.size()>0)
  13. {
  14. for(int i=0;i<tekst.size();i++)
  15. {
  16.  
  17. if(tekst[i]==' ')wynik++;
  18. }
  19. cout<<wynik<<endl;
  20. wynik=1;
  21. }
  22. else
  23. {
  24. wynik=0;
  25. cout<<wynik;
  26. }
  27. }
  28.  
  29. fin.close();
  30. }
  31.  
  32.  
  33. #include <iostream>
  34. #include <fstream>
  35. using namespace std;
  36. main()
  37. {
  38. ifstream fin("dane.txt");
  39. ofstream fout("wynik.txt");
  40. int liczba1,liczba2,liczba3,iloczyn;
  41. while(!fin.eof())
  42. {
  43. fin>>liczba1>>liczba2>>liczba3;
  44. iloczyn=liczba1*liczba2*liczba3;
  45. if(iloczyn>=50&&iloczyn<=1000) fout<<iloczyn<<endl;
  46. }
  47. fin.close();
  48. fout.close();
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement