fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. void output_p(std::ostream& _out, std::istream& _in){
  7. int i = 0;
  8. char c;
  9. std::string s;
  10.  
  11. while(! _in.eof() && ! _in.fail()){
  12. if(! _in.get(c))
  13. c = '.';
  14.  
  15. if(c == '.' || c == '!' || c == '?'){
  16. if(! i && (s.length() > 0))
  17. _out << s << std::endl;
  18. s = "";
  19. i = 0;
  20. } else if(c == ',')
  21. i = 1;
  22. else
  23. s += c;
  24. }
  25. _out.flush();
  26. }
  27.  
  28.  
  29. int main(void){
  30. char s[] = "Yulia31, ужас, зачем столько инклудов?"\
  31. "Оставьте только iostream и fstream."\
  32. "И да, std:: можете не писать, у вас пространство "\
  33. "имён уже написано (using namespace std). Мимопроходил.";
  34. std::istringstream sp(s);
  35. output_p(std::cout, sp);
  36. /*
  37. std::ifstream fin("input.txt");
  38. std::ofstream fout("output.txt");
  39. output_p(fout, fin);
  40. fout.close();
  41. fin.close();
  42. */
  43. return 0;
  44. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Оставьте только iostream и fstream
 Мимопроходил