so...ive been trying to do the coin toss exercise and all the code that ive seen online so far looks way more "elaborated"...so im not really sure about what i came up with, i ran it a few times and looks fine...i want to know if this does the trick (as you may have noticed im not looking for elegance points right now)
std::cin.clear(); // reset any error flags
std::cin.ignore(32767, '\n'); // ignore any characters in the input buffer until we find an enter character
std::cin.get(); // get one more char from the user
return 0;
}
Well, your coin might be slightly biased to one or other side (because of usin modulus operator and bad RNG), but it will do the trick.
Oh, and if you will run your program twice in quich succession (in the same second) you will get same result. Also with many implementations your first number might be predictable (heads on odd seconds, tails on even)