fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. char add(string s)
  5. {
  6. string s1="";
  7. for(int i=0;i<s.length();i++)
  8. {
  9. for(int j=0;j<s.length();j++)
  10. {
  11. s1=s1[j]+s[i];
  12. }
  13. }
  14. return s1;
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20. string s,s1;
  21. int k;
  22. cin>>s>>k;
  23.  
  24. for(int i=0;i<k;i++)
  25. {
  26. s1=s1+s;
  27. }
  28. for(int i=0;i<5;i++)
  29. {
  30. s1=add(s1);
  31. }
  32.  
  33. cout<<s1<<endl;
  34. }
Compilation error #stdin compilation error #stdout 0s 15240KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘char add(std::__cxx11::string)’:
prog.cpp:14:9: error: cannot convert ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ to ‘char’ in return
  return s1;
         ^~
stdout
Standard output is empty