fork download
  1. char test(std::string &h);
  2. int main() {
  3. std::string e("Test");
  4. cout << test(e);
  5. return 0;
  6. }
  7.  
  8. char test(std::string &h){
  9. return h[3];
  10.  
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:16: error: ‘string’ is not a member of ‘std’
 char test(std::string &h);
                ^~~~~~
prog.cpp:1:16: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
+#include <string>
 char test(std::string &h);
                ^~~~~~
prog.cpp:1:24: error: ‘h’ was not declared in this scope
 char test(std::string &h);
                        ^
prog.cpp: In function ‘int main()’:
prog.cpp:3:10: error: ‘string’ is not a member of ‘std’
     std::string e("Test");
          ^~~~~~
prog.cpp:3:10: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
prog.cpp:4:5: error: ‘cout’ was not declared in this scope
     cout << test(e);
     ^~~~
prog.cpp:4:18: error: ‘e’ was not declared in this scope
     cout << test(e);
                  ^
prog.cpp:4:19: error: ‘test’ cannot be used as a function
     cout << test(e);
                   ^
prog.cpp: At global scope:
prog.cpp:8:16: error: redefinition of ‘char test’
 char test(std::string &h){
                ^~~~~~
prog.cpp:1:6: note: ‘char test’ previously defined here
 char test(std::string &h);
      ^~~~
prog.cpp:8:16: error: ‘string’ is not a member of ‘std’
 char test(std::string &h){
                ^~~~~~
prog.cpp:8:16: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
prog.cpp:8:24: error: ‘h’ was not declared in this scope
 char test(std::string &h){
                        ^
stdout
Standard output is empty