grep third line after match

C++
Include -A flag to add lines after match
grep match -A 3	#display match line and 3 after linesawk 'c&&!--c;/pattern/{c=N}' file
Source

Also in C++: