grep -Include

grep pattern -r --include="*.cpp"
Itchy Ibis