0

in a method PrintName , if i want to print name if i use " cout<<name;" it works , but not if i use " return name". Why?

https://code.sololearn.com/cjj8nNJa5ZOb/?ref=appif

15th Apr 2023, 1:58 PM
Juan José Molina
Juan José Molina - avatar
2 odpowiedzi
+ 5
If you want to use return name, you have to change the return type of the method printNane , from void to string. The cout only prints on screen, the return returns something which is different. https://code.sololearn.com/cUxl7vG6Hfo0/?ref=app
15th Apr 2023, 2:13 PM
Black Winter
+ 2
thank you! i was confused whith that
15th Apr 2023, 5:18 PM
Juan José Molina
Juan José Molina - avatar