Question: Write a C++ program to process periodic table information from a file. Each element will have an atomic number, a name, an abbreviation, and a
Write a C++ program to process periodic table information from a file.
Each element will have an atomic number, a name, an abbreviation, and a mass. Your program must include:
1. An Element structure to be defined in a header file: Element.h
2. A function read_table that will return the number of elements read from the file and via a reference
parameter, a pointer to an array of pointers to the elements read. The data file is located at
directory/periodictable.dat. This function must read in the data by constructing a linked list and
convert the linked list into an array of pointers. The prototype for this function is to be included in the
Element.h file. The function will return 0 on any error condition.
3. A main program that will call read_table to read in the table, sort the table using the element name and print
out the table using the required output format. You can use qsort in cstdlib or write your own sort function.
4. Dynamic memory must be allocated and deallocated properly.
the data file: https://openload.co/f/GKn0BP1RndE/periodictable.dat
or this link: https://drive.google.com/file/d/15wBN3j7JVoEY3DygTYwCxvwyBRLsUOm7/view?usp=sharing

Required Output: 123456789012345678901234456789012345679 Periodic Table by F. Last formatting guide Number of elements 118 Name Abr ANo Mass Actinium Aluminum ...all the elements Zinc Zirconium 89 227.00 Al 13 26.98 Ac Zn 30 65.38 Zr 40 91.22 The average mass: 146.44 Required Output: 123456789012345678901234456789012345679 Periodic Table by F. Last formatting guide Number of elements 118 Name Abr ANo Mass Actinium Aluminum ...all the elements Zinc Zirconium 89 227.00 Al 13 26.98 Ac Zn 30 65.38 Zr 40 91.22 The average mass: 146.44
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
