The return type for stringThing
must be either void
or string
, not both. You also must include <string>
, if you want to use string.
Since you want to output the return value of stringThing()
in main
, I guess it should be
std::string stringThing (std::string shiftdir, const std::string &teststring)
But then, you must also return a string from your function
if (shiftdir == "right") return teststring + " " + "Bit Shifted right"; else return teststring + " " + "Bit Shifted left";
for example.
Your parameter std::string &teststring
won’t work with your const char*
argument. So either declare it as a copy by value string
only, or better const string&
.