g++output: main.cpp: In function 'std::string rev(std::string)': main.cpp:20: warning: statement has no effect main.cpp:21: error: invalid conversion from 'char' to 'const char*' main.cpp:21: error: initializing argument 2 of 'std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(typename _Alloc::size_type, const _CharT*) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]' Code: #include #include using namespace std; string rev (string foo); int main () { string input; string bar; cout << "Enter your text: "; getline(cin,input); bar = rev(input); cout << bar << endl; return 0; } string rev (string foo) { int s = foo.size(); string bar; for(s ; s >= 0; s--) { bar.insert(1,foo[s]); } return bar; }