COUT VS RETURN

Hi, I am trying to make a program and our schools autogravder doesn't like cout, rather it likes "return" so I have a statement like this:

 
   cout << start_marker << word << end_marker << endl;

how could I write this again with out cout?
cout makes something appear on the screen.

return sends a value back from a function to the function that called it.

They're completely different things.

It sounds like you're asking "How can I return the value word from my function?" If that is what you're asking, like this:

return word;
Thank you, but I want the word to be between *word* and the star/end markers are the ones outputting the * or whatever start/end markers inputed in the main function
Now it sounds like you're asking:

How can I return *word* ?

You need to get a lot better at asking questions.
ok I'm sorry, I have a function for starting and ending markers, I want the word to be between whatever those markers are set to , and thats what I need to return. for example if the start marker was set = * and the end marker was set = / I need the output to be "*word/"
it worked fine when I had it cout << start << word << end, however, the autograder we use didn't let that work
If start and word and end are of type string:

return (start + word + end);

Definitely time to learn what a C++ function is and how to return values. Without that, you are really not going to get far.
Registered users can post here. Sign in or register to post.