How are the exchange rate between two countries determined? For example how is exchange rate between the dollar and the euro established?

My guess is it has to do with some form of demand/supply but I am finding it hard to imagine how it goes.

This question arises from my research into cryptocurrencies where it seems anyone can create their own coin which can also get traded with another coin. In such a situation, similar question arises: how is the price of one coin established relative to another?

My guess is, it is the same dynamics that sets exchange rates with fiat currencies that is at play with cryptocurrencies? If so how does it operate? if not how do the two operates?