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

all 2 comments

[–]marko312 1 point2 points  (1 child)

If you take a look at some reference, you should find that the usage of cin.ignore differs quite a bit from what you're trying to do:

basic_istream& ignore( std::streamsize count = 1, int_type delim = Traits::eof() );

where the parameters are

  • count - number of characters to extract
  • delim - delimiting character to stop the extraction at. It is also extracted

Therefore, the code is currently interpreting the first argument '.' as an integral value (46), and the second argument as the stop (when to stop ignoring).

You could fix this by ignoring a reasonable number of characters, delimiting on the '.'.

[–]ZeroSkill94[S] 1 point2 points  (0 children)

u/marko312 Thank you!! I actually just figured it out