fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. string prostring(string input1)
  5. {
  6. boolean isOn = false;
  7. int j=0;
  8. string s[];
  9. string y="";
  10. int n = 0;
  11. int p=0;
  12. int h;
  13.  
  14. for(int i=0; i<input1.length(); i++)
  15. {
  16. char x = input1.charAt(i);
  17. if(x == " ")
  18. {
  19. y += x;
  20.  
  21. }
  22. else if(x == "@")
  23. { if(isOn==false)
  24. {
  25. isOn=true;
  26. }
  27. else
  28. {
  29. isOn=false;
  30. }
  31. }
  32. else if(x == "#")
  33. {
  34. s[j] = y;
  35. j++;
  36. y="";
  37. }
  38. else if(x == "<")
  39. {
  40. n++;
  41. }
  42. else if(x == ">")
  43. {
  44. p++;
  45. h++;
  46. }
  47. else if(x == "/")
  48. {
  49. if(y=="")
  50. {
  51. j=j-1;
  52. y=s[j];
  53. }
  54. else
  55. {
  56. y=y.substr(0,y.length-1);
  57. }
  58. }
  59. else if(x == "?")
  60. {
  61. if(j==s.length-1)
  62. { }
  63. else
  64. {
  65. j=j+1;
  66. }
  67. }
  68. else if(x == "^")
  69. {
  70. if(j==0)
  71. {}
  72. else
  73. {
  74. j=j-1;
  75. }
  76. }
  77. else
  78. {
  79. if(isOn == true)
  80. {
  81. x = toupper(x);
  82. }
  83. else
  84. {
  85. x = tolower(x);
  86. }
  87.  
  88.  
  89. if (n != 0)
  90. {
  91.  
  92. string t = s[j];
  93. h = t.length-n+1;
  94. string temp = t.substr(0,t.length-n);
  95. string temp1 = t.substr(t.length-n,n);
  96. strcat(temp,x);
  97. strcat(temp,temp1);
  98. s[j] = temp;
  99. y = s[j];
  100.  
  101. }
  102. else if (p != 0)
  103. {
  104. string t = s[j];
  105. if(h==t.length)
  106. {
  107. while(p!=0)
  108. {
  109. t=t+" ";
  110. }
  111. t=t+x;
  112. s[j] = t;
  113. }
  114. else
  115. { string t=s[j];
  116. h=h+p;
  117. string temp = t.substr(0,h-1);
  118. string temp1 = t.substr(h-1,t.length-h+1);
  119. strcat(temp,x);
  120. strcat(temp,temp1);
  121. s[j]=temp;
  122. y=s[j];
  123. }
  124. }
  125. else
  126. {
  127. y=s[j];
  128. y=y+x;
  129. }
  130.  
  131. }
  132.  
  133. }
  134.  
  135. return s[];
  136.  
  137. }
  138.  
  139. int main() {
  140. string input;
  141. getline(cin,input);
  142. string g[]=prostring(input);
  143. for(int i=0;i<g.length;g++)
  144. {
  145. cout<<s[i]<<endl;
  146. }
  147.  
  148. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘std::__cxx11::string prostring(std::__cxx11::string)’:
prog.cpp:6:3: error: ‘boolean’ was not declared in this scope
   boolean isOn = false;
   ^~~~~~~
prog.cpp:8:11: error: array size missing in ‘s’
  string s[];
           ^
prog.cpp:16:18: error: ‘std::__cxx11::string {aka class std::__cxx11::basic_string<char>}’ has no member named ‘charAt’
  char x = input1.charAt(i);
                  ^~~~~~
prog.cpp:17:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  if(x == " ")
          ^~~
prog.cpp:22:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == "@")
               ^~~
prog.cpp:23:7: error: ‘isOn’ was not declared in this scope
  { if(isOn==false)
       ^~~~
prog.cpp:32:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == "#")
               ^~~
prog.cpp:38:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == "<")
               ^~~
prog.cpp:42:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == ">")
               ^~~
prog.cpp:47:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == "/")
               ^~~
prog.cpp:56:19: error: invalid use of member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
    y=y.substr(0,y.length-1);
                 ~~^~~~~~
prog.cpp:59:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == "?")
               ^~~
prog.cpp:61:11: error: request for member ‘length’ in ‘s’, which is of non-class type ‘std::__cxx11::string [1] {aka std::__cxx11::basic_string<char> [1]}’
   if(j==s.length-1)
           ^~~~~~
prog.cpp:68:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  else if(x == "^")
               ^~~
prog.cpp:79:8: error: ‘isOn’ was not declared in this scope
     if(isOn == true)
        ^~~~
prog.cpp:93:9: error: invalid use of member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
   h = t.length-n+1;
       ~~^~~~~~
prog.cpp:94:30: error: invalid use of member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
   string temp = t.substr(0,t.length-n);
                            ~~^~~~~~
prog.cpp:95:29: error: invalid use of member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
   string temp1 = t.substr(t.length-n,n);
                           ~~^~~~~~
prog.cpp:96:16: error: ‘strcat’ was not declared in this scope
   strcat(temp,x);
                ^
prog.cpp:105:12: error: invalid use of member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
    if(h==t.length)
          ~~^~~~~~
prog.cpp:118:38: error: invalid use of member function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
        string temp1 = t.substr(h-1,t.length-h+1);
                                    ~~^~~~~~
prog.cpp:119:21: error: ‘strcat’ was not declared in this scope
        strcat(temp,x);
                     ^
prog.cpp:135:11: error: expected primary-expression before ‘]’ token
  return s[];
           ^
prog.cpp: In function ‘int main()’:
prog.cpp:142:28: error: initializer fails to determine size of ‘g’
  string g[]=prostring(input);
                            ^
prog.cpp:143:18: error: request for member ‘length’ in ‘g’, which is of non-class type ‘std::__cxx11::string [1] {aka std::__cxx11::basic_string<char> [1]}’
  for(int i=0;i<g.length;g++)
                  ^~~~~~
prog.cpp:143:26: error: lvalue required as increment operand
  for(int i=0;i<g.length;g++)
                          ^~
prog.cpp:145:9: error: ‘s’ was not declared in this scope
   cout<<s[i]<<endl;
         ^
stdout
Standard output is empty