Hello, I have this problem that's been bothering me on the back of my head for so long now. I don't know how to pursue or even break it down, I've tried reading the book, look at notes, nothing helps. Problem is, I have this file which contains
/*
Nitrite N1O2
NitrousOxide N2O1
Nitric N1O1
Nitryl N1O2
list goes on
*/
I've read from the file ( easy ) but the directions for this lab states
to store for each special formula along with names then display it in ascending order. The formulas are to be stored in structs and then placed in vectors. Basically the output should look like this.
N1O1
Nitric
N1O2
Nitrite, Nitryl
N2O1
NitrousOxide
etc.
It's said to be done "without sorting" and states
Notice that the output is sorted only by the number of nitrogen atoms.
There is no attempt to sort by anything else.
Or, put another way: all other orderings show simply the order the items were taken from the file.
I don't understand how this can be done without sorting. Please help.