Q: once i've written a melody how do i figure out what chords go with it?
A: do a study of all the melodies you know the best. not really study, learn what the chords are. after you learn 20 melodies and their chords, you will have a slightly better idea of what chords will go with a melody. after you learn 100 melodies and their chords, you will have an even better idea of what chords will go with a melody.
after you learn 250 melodies and their chords, you will have a much better idea of what chords will go with a melody. after you learn 1000 to 2000 melodies and their chords, you will have a much much much better idea of what chords will go with a melody