[1] She came out of the room, crying loudly.
[2] She came, crying loudly, out of the room.
Both are correct. You could even use [3]:
[3] Crying loudly, she came out of the room.
A gerund is a word that looks like a verb but functions as a noun. That is, it ends in -ing but it can be a subject, an object of the verb, or an object of a preposition. In [1] through [3] "crying" doesn't function as a noun (a subject or an object), so it must be a participle.
Also, gerunds never require punctuation. Note, in [1] through [3] there is punctuation: a comma in each sentence.
"crying" is not a gerund. "crying" is a participle, a present participle. How do we know that? Consider,
[4] She came out of the room. She
was crying loudly.
'crying' and 'was' form a continuous verb form. Participle, note the word "Part" in there, means it is part of a verb. Moreover, a participle modifies a (pro)noun, like this,
She, crying loudly, came out of the room.
'crying loudly' modifies 'She'.
A final test would be to ask, "Who
was crying loudly?" The answer: "She". So, 'crying' must be a participle since it functions as part of the continuous verb 'was crying'.
Here's a great resource:
http://owl.english.purdue.edu/handou...g_verbals.html
All the best,