With talking in tongues, some of the time it says they talked in tongues and prophesied. Was that part of talking in tongues, or separate? I always get confused. I know in I Corinthians 14:22 mentions reasons for each, but I don't know if they are separate.
Speaking in tongues means having the ability to speak in different languages. The miraculous gift of the Spirit was to give the ability to speak in other languages without needing to study the language. "When this sound was heard, the multitude came together, and were bewildered, because everyone heard them speaking in his own language. They were all amazed and marveled, saying to one another, "Behold, aren't all these who speak Galileans? How do we hear, everyone in our own native language?" (Acts 2:6-8).
Prophecy is being a spokesman. Probably the best definition is "So the LORD said to Moses: "See, I have made you as God to Pharaoh, and Aaron your brother shall be your prophet. You shall speak all that I command you. And Aaron your brother shall speak to Pharaoh to send the children of Israel out of his land"" (Exodus 7:1-2). God told Moses was to say, Moses then told Aaron what to say, Aaron spoke Moses' words, and Pharaoh heard. A prophet did not make up what he was to say. He was told word-for-word what he was to say and then he relayed the message to whoever was to receive it. Of course, we generally connect prophecy with those who spoke for God. In the early church, before the Bible was completely written, the prophets were the source for God's words. When perfect word of God was completely written, the gifts came to an end (I Corinthians 13:8-10).
I Corinthians 12 means a number of gifts of the Holy Spirit, among them are speaking in tongues and prophecy. Not every Christian had a gift, and some Christians might have more than one gift. The distribution of the gifts was solely up to what the Spirit of God decided.