Nearly every melody line has underlying harmonies (chord) which reflect the notes in each bar. E.g., in a bar of C-E-F-G, there are notes which make Cmaj., so that chord will fit in that bar. 

In a bar with, for example, an F and A, this will give you more scope - F, Dm, G<sub>9</sub> come to mind.                                                                      

Often there's a note which won't fit a chord, and if it's on a weak part of the bar, it won't count towards that chord. Weaker parts could be 2nd or last beat, or maybe the 'and' between beats. 1st and 3rd (in 4/4) are places to look for components of a chord. When you move out of key, as in C - G&#x266d;, there are no common notes, so either change chord within the bar, or possibly use a B&#x266d; note, which could fit both C<sub>7</sub>  and G&#x266d;  

Really need that sample.