strange occurence mittle piecec++ code I wrote

Started by
9 comments, last by NightCreature83 11 years, 5 months ago
no, it does the following thing otherwise paste the code and test it.... type eerste liefdes nummer: a (I type a instead of a number and press enter) the result is:type tweede liefdesnummer: 0 * 49 = 0 (that is what it puts on the screen after the enter of the first a nightcreature..are you speaking dutch?spreek je nederlands?


Ja, ik spreek Nederlands woon er alleen niet meer.

Robust input from the user is surprisingly hard to do, as you can probably gather from rip-off's post. I rarely write programs where the user types anything in (my programs read command-line options and configuration files instead) but when I do, I always read the input line by line with `std::getline(std::cin, line)' and then parse the line. In my experience it's the safest way to do things. Since you are a beginner, it is likely that rip-off's code is too complicated for you at this stage. If that's the case, skip this whole robust-input thing and get on with learning the basics of the language (just be careful when you type ;) ). Once you are more comfortable with the language, come back and read his very useful code.

I found using JSON or XML parsers to be easier then using ini or text files. Also gives you the ability of skipping whole blocks if the code doesn't understand the content.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

This topic is closed to new replies.

Advertisement