C++ printing object “names” | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ printing object “names”

I want to print my object’s name. I wrote “cout << obj -> name << “‘s” << “points: “ << obj -> points << endl;” Which is something that has worked many times before. But now, it prints out “ ‘s points: *address of points*”. So the name is blank. I have no errors, but it prints out nothing. I think I know why it is printing the address of points and not the actual poinsettia because I wanted that to happen, but why does it not print anything where the name is supposed to be? Am I missing something really simple? Thanks for any help :)

7th Jul 2019, 9:37 AM
Noah
7 Answers
+ 4
Can you attach the code in which you are facing the problem
7th Jul 2019, 10:17 AM
Saurabh Tiwari
Saurabh Tiwari - avatar
+ 2
edit this question by tapping the three dots on the right side then you will see + symbol tap it and add your code
7th Jul 2019, 1:04 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
0
Ok, how do I do that?
7th Jul 2019, 12:54 PM
Noah
0
Oh I noticed it says “poinsietta” instead of pointer. I think my keyboard was set to spanish haha
7th Jul 2019, 12:55 PM
Noah
0
It only works with code from Sololearn, I think, and I wrote this on Visual Studio. So I dont think I can upload it. I didnt see an option for it at least
7th Jul 2019, 2:16 PM
Noah
0
copy paste it on sololearn's c++
7th Jul 2019, 2:39 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
0
Or just use pastebin.
7th Jul 2019, 3:31 PM
Vlad Serbu
Vlad Serbu - avatar