avukas

rok13

Jul 7th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <complex>
  3. #include<deque>
  4. #include<string>
  5. #include<stdexcept>
  6.  
  7.  
  8. void funkcija(std::string &s1, int n)
  9. {
  10. std::string s2;
  11.  
  12. for(int i(0); i<s1.length(); i++)
  13. {
  14.  
  15. int brojac(0);
  16. s2.push_back(s1[i]);
  17.  
  18. while (brojac != n)
  19. {
  20. s2.push_back(' ');
  21. brojac++;
  22. } }
  23. s1.resize(s2.length());
  24. s1=s2;
  25.  
  26.  
  27. }
  28.  
  29. int main()
  30. {
  31. int n;
  32. std::cout<<"Unesi broj razmaka: ";
  33. std::cin>>n;
  34. std::cout<<"Unesi string: \n";
  35. std::string s1;
  36. std::cin>>s1;
  37. funkcija(s1, n);
  38. std::cout<<s1;
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment