Problem with my first program

Issue fixed. Thank you for all the help.

1
2

    
Last edited on
In your Copybyebye function you define a new string name rather than using your old one. Without initialization it is empty, thus you get an empty string when you attempt to put it on the console.

The name the user passes in is stored in a value inside the Copyhello() function. Once that function is completed and returns, all values it had stored in the runtime stack are lost.

Make string Copyhello() a string returning function. Return the string name to your main function and then pass it into your void Copybyebye(string) function.

If this doesn't make sense then you need to go back and read up on functions
Your scopes are conflicting with each other:
http://www.tutorialspoint.com/cplusplus/cpp_variable_scope.htm
Thank you for quick responses, those helped immensely. I got it to work the way I wanted! :)

The feeling after creating a first program is something strange. :)

Thank you, thank you.
For future reference, if your forum post is solved, then mark it as solved.
More importantly, don't delete your question like that. Someone might have used it to help them later, and now whoever helps that person has to type the same thing again.
Yea, I was actually curious to see the code, but it was gone :)
Topic archived. No new replies allowed.