Jump to content

I have been away from codeing for a few year and was never that good to begin with but the other day I came across a problem I desided to try to code a solution to.  However when I run scanf after printf the progeam wants the input first.  I have tried old programs that worked the last time I used them and found examples online such as the one pictured and the same thing happenes. I have used both cpp.sh and visual studio to compile with the same result.  Any ideas why this is or even better how to fix it?

post-248648-0-10528400-1441653451.png

Link to comment
https://linustechtips.com/topic/445881-cc-scanfprintf-problem/
Share on other sites

Link to post
Share on other sites

Try using the line "fflush(stdin);" after the scanf, it clears the keyboard buffer and should solve your problem.

At least I think it should make it work.

Forget that, it's a problem with that website you use.

I once had one of these, now I've got this.

Link to comment
https://linustechtips.com/topic/445881-cc-scanfprintf-problem/#findComment-5975944
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×