Indexing words separated by underscores
Spotlight should already index these files, it does on my Mac.  Try searching for them as follows:  


Open a Finder window
Press Command+F
Change the search parameters to "Name" and "contains" to search for file names or just "Contents" to search text within the files
Enter your search term  


Once you start typing, spotlight should start showing results in the window  

Note: Check in the 'Privacy' tab of the Spotlight preference pane in System Preferences to ensure you haven't excluded the folder/drive where your .h and .cpp files reside.