In this exercise we will adapt our program
readIsotope.cxx and make it reading the new
nuclei.txt file containing the data of known nuclei. You have to adapt the code to take into account the new data structure and the new class,
During code development you can use the
nuclei_small.txt data file which contains a fraction of all data. When your program reads the data ok you can test with the big
Note, that the input stream operator for the
Nucleus class is not provided and so you need to read the data in local variables first and then use the class “set” functions to save them in the
Copy the code in the body of
main() function from
Change the filename value to
Use your editor Find&Replace function and change the strings isotope, isotopes, Isotope into nucleus, nuclei, Nucleus respectively.
Change the variables after the comment // Define variables to hold data to correspond to the data in the provided file. Define them in the same order as they appear in the file.
stringtype to read half-life values
Change the line after the comment // Read data of one nucleus to read all the data for one nucleus
Adapt the code after the comment // Define Nucleus object and use the
Nucleus class setters to fill in read data into the