fork(5) download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5.  
  6. int main()
  7. {
  8. int ile = 0;
  9. std::cin >> ile;
  10. for ( int i = 0 ; i < ile ; ++i)
  11. {
  12. std::string litera;
  13. std::string koncowy_ciag;
  14. std::string klon;
  15. koncowy_ciag.clear();
  16. litera.clear();
  17. std::cin >> litera;
  18. klon.insert(0,litera);
  19. int flaga = 0;
  20. for ( int k = 0 ; k < litera.size() ; ++k)
  21. {
  22. int pomicnicze_k = k;
  23. int pom_k = k;
  24. if ( litera[k] == litera[k+1]) //W PETLACH NIE PISAC K++ TYLKO K+1. PIERWSZA WERSIA NIE DZIALA
  25. {
  26. flaga++;
  27. if ( flaga > 1 )
  28. {
  29. koncowy_ciag.erase(koncowy_ciag.begin()+k);
  30. koncowy_ciag += std::to_string(flaga);
  31. }
  32. else
  33. {
  34. koncowy_ciag += litera[pomicnicze_k];
  35. koncowy_ciag += std::to_string( flaga );
  36. }
  37. }
  38. else if ( (litera[k] != litera[k+1]) && ( flaga > 0 ) )
  39. {
  40. flaga = 0;
  41. }
  42. else if ( litera[k] != litera[k+1] )
  43. {
  44. flaga = 0;
  45. koncowy_ciag += litera[k];
  46. }
  47. k = pom_k;
  48. }
  49. std::cout << "to jest koncowy wyraz: " << koncowy_ciag << std::endl;
  50. }
  51. return 0;
  52. }
  53.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:30: error: 'to_string' is not a member of 'std'
prog.cpp:35: error: 'to_string' is not a member of 'std'
stdout
Standard output is empty