Carbon dioxide is a carbon atom and two oxygen atoms, therefore CO2
For the others, they are hydrocarbons.
The first part of the name is determined by how many carbon atoms there are. The second part, is by the type. Alcohol, Alkane, Alkene, alkynes, acid, esters, amides.