There are several ways to figure out what type of dragon you are looking at(fire breathing or frost breathing). The easiest way is on the PC. Use the tilde key to bring up the developer's console, click on the dragon and type getav fireresist followed by the enter key. If it's a fire breather you'll see a value of 50.00 and if it is a frost breather a value of -25.00 will be displayed. Hit the tilde key again to close the developer's console and resume play.
If you're on a console(or on PC and don't want to use the developer's console) there are still a couple ways to make this determination. The first is to alternately cast fire and frost spells of the same level at the dragon and see which does more damage to its health bar(difficult if it's flying around). The disparity in damage should be pretty obvious(resistance to your element means it takes half damage, weakness means it takes 25% more damage than normal or 2.5 times the damage compared to damage from the element of which it's resistant).
The final way is to wait for it to shout its element at you. This can be a bit of a waiting game at very high player level since most dragons you face will be the legendary type. They tend to prefer their Drain Vitality shout over their elemental shout and will probably use Drain Vitality several times before they use their other shout. Once their element comes out of their mouth, you'll know.