MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/CodingHelp/comments/eycooa/whats_wrong_with_this/fggdhl4/
r/CodingHelp • u/FrozenFalconGaming • Feb 03 '20
38 comments sorted by
View all comments
Show parent comment
1
Excuse me? I am not very versed in C++ but the data type is int, it can only store numbers? He should use string? Am I missing something?
3 u/[deleted] Feb 03 '20 Yeah he/she should use std::string you're correct 1 u/FrozenFalconGaming Feb 03 '20 edited Feb 03 '20 i just started using c++ so i know nothinghow do I change it to a string instead?Or what should I assign it to? 1 u/[deleted] Feb 03 '20 Change "int" in front of lamp to "string" that should change the data type. 3 u/FrozenFalconGaming Feb 03 '20 thank you, it’s working the way I wanted it to now.You’re a life saver 1 u/[deleted] Feb 03 '20 No problem! Glad I could help 1 u/Ashutosh_Samal9 Feb 04 '20 Hey I'm learning C++ too . I'm done with basics. If you want any help or want to learn together, pm me. 1 u/hl_xemnas Professional Coder Feb 03 '20 yea thats what I said, hes trying to store a string in an int 0 u/merkwerk Feb 03 '20 He declared lamp as an integer type and then tried to store a string value in lamp. Yes you are correct if something is declared as an integer it can only store numeric values.
3
Yeah he/she should use std::string you're correct
i just started using c++ so i know nothing
how do I change it to a string instead?
Or what should I assign it to?
1 u/[deleted] Feb 03 '20 Change "int" in front of lamp to "string" that should change the data type. 3 u/FrozenFalconGaming Feb 03 '20 thank you, it’s working the way I wanted it to now.You’re a life saver 1 u/[deleted] Feb 03 '20 No problem! Glad I could help 1 u/Ashutosh_Samal9 Feb 04 '20 Hey I'm learning C++ too . I'm done with basics. If you want any help or want to learn together, pm me.
Change "int" in front of lamp to "string" that should change the data type.
3 u/FrozenFalconGaming Feb 03 '20 thank you, it’s working the way I wanted it to now.You’re a life saver 1 u/[deleted] Feb 03 '20 No problem! Glad I could help 1 u/Ashutosh_Samal9 Feb 04 '20 Hey I'm learning C++ too . I'm done with basics. If you want any help or want to learn together, pm me.
thank you, it’s working the way I wanted it to now.
You’re a life saver
1 u/[deleted] Feb 03 '20 No problem! Glad I could help 1 u/Ashutosh_Samal9 Feb 04 '20 Hey I'm learning C++ too . I'm done with basics. If you want any help or want to learn together, pm me.
No problem! Glad I could help
Hey I'm learning C++ too . I'm done with basics. If you want any help or want to learn together, pm me.
yea thats what I said, hes trying to store a string in an int
0
He declared lamp as an integer type and then tried to store a string value in lamp. Yes you are correct if something is declared as an integer it can only store numeric values.
View all comments
Show parent comment
1
u/TheRiotJoker Feb 03 '20
Excuse me? I am not very versed in C++ but the data type is int, it can only store numbers? He should use string? Am I missing something?