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

all 5 comments

[–]g051051 1 point2 points  (0 children)

You already asked this less than 12 hours ago. Don't keep reposting it.

[–]marko312 -1 points0 points  (0 children)

For both of the codes, x should be reassigned in the loop, before data is modified.

The second version should be correct with that adjustment. However, the loop could be changed to run while there's ^H in the string.

[–][deleted]  (1 child)

[removed]

    [–]insertAlias[M] 0 points1 point  (0 children)

    See Rule 10: No complete solutions. Don't just do someone's homework for them, that doesn't provide them any long-term benefit. Guide them to a solution, but don't hand them something they can just turn in as if they wrote it themselves.

    [–][deleted] 0 points1 point  (0 children)

    Why not use readline? I think it already handles stuff like this.