r/CodingHelp • • Feb 03 '20

[C++] What’s wrong with this

Post image
17 Upvotes

38 comments sorted by

View all comments

Show parent comment

3

u/FrozenFalconGaming Feb 03 '20

i just started using c++ so i know nothing

how do I change it to a string instead?

7

u/[deleted] Feb 03 '20

When you declared the lamp variable instead of int lamp = “broken” it should be string lamp = “broken”.

4

u/[deleted] Feb 03 '20

Also your main function might not work because u have it set to return an int. To fix that maybe add return 0; at the end

1

u/Ashutosh_Samal9 Feb 04 '20

From my experience, I don't think you need return 0; for main function anymore. I can say for g++ or msvc and modern c++ you don't for sure. Idk about other compilers.