When to use cin.ignore()

when will i know to use this cin.ignore() and when to use it, and also why we use it

@sktg99 hey sancit same question asked on stack overflow