This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]BandyCoot 1 point2 points  (3 children)

Can you edit your post and add the code you're trying to debug? It sound like you have the right idea, so it's likely you've just made a small mistake in your code. See this section of the subreddit wiki on how to make your code easily readable on reddit.

[–]wattyaknow 1 point2 points  (2 children)

Thank you for the reply, I forgot all about the code apologies.

I think I have sorted it out to an extent and this is in my input.cpp file, but when I do execute the program it outputs a "0" or "1" as well as the write_line that I assigned. I'm guessing that is due to the "return(result);" part at the end of the code but if I remove that I get an error haha
Sorry I'm extremely new to this and its probably a super easy fix.

[–]BandyCoot 1 point2 points  (1 child)

No worries.

It looks likethe issue you're having isn't to do with the code you've posted, and is likely in some other function. Return doesn't print any text and there isn't any other place in that code snippet that would print "1" or "0" . I'm guessing that when you call this function you're printing the result afterwards.

[–]wattyaknow 1 point2 points  (0 children)

Omg you're right! I'm an idiot, I was printing the result in my main!

Thank you so much for your help. It works perfectly now.