C++ : Sorting hydrocarbon chemical formulae
Not what you're looking for?
We have been given a file of chemical formulae, specifically hydrocarbons that consist of only hydrogen and carbon atoms.
Each line of the file contains the name of the chemical followed by its molecular formula in the form C#H# where # is the number of carbon (C) and hydrogen (H) atoms. No name in the file contains blanks.
Because hydrocarbons with the same molecular formula can appear in many structural forms and each of the forms has a different name, the same molecular formula might appear more than once in the file with different names. (e.g.: Butane and 2-methylpropane both have the molecular formula C4H10.)
We would like to keep one entry for each unique molecular formula along with all the names for that formula and then display all these entries in order by ascending number of carbon atoms.
Please refer to the attachment for further details.
Purchase this Solution
Solution Summary
Source code has been provided with functionality to output the processed information in both the formats; it is a matter of commenting one line and uncommenting another as explained in the source code.
Solution Preview
Please find attached 373024.cpp that has been tested for warning free compilation using "g++ -Wall 373024.cpp", and for execution with attached input files.
Program takes the ...
Purchase this Solution
Free BrainMass Quizzes
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Basic Networking Questions
This quiz consists of some basic networking questions.