Each molecular formule will be kept in a struct with the fields the names for formula Note that is a collection of names . the number of carbon atoms the number of hydrogen soms We will be storing these structs in a vector An example Suppose this is the files -Butane CH10 Propyne C3H3 1,3-Butadiyne C4H2 Hexane C6H14 Butane CH10 iso-Butane C4H10 Pentane CSH12 Your program should store these five entries and then display: C33 Propyne C4HQ 1,3-Butadiyne C4H10 n-Butane Butane iso-Butane C5H12 Pentane C6H14 Hexane The collection has been sorted by number of carbons and then the number of hydrogen assure you know from data structures how to write some simple sort algorit , og bubble sort, selection sort or insertion sorte r hese run in quadras time, but we don't want you spending a lot of time Implementing a more effectent sort.) Write a function that will be passed your collection and modity that it is sorted Notes As always, write good clean code. What does that mean? Good use of functions to make code more readable. . Good naming of everything No long lines. What's long? Anything over 80 characters. And now that you know about function prototypes of not covered in your lecture section took it up in the notes or ask in labi. there should first be one for each of your functions other than main, then the definition of main, and then the definitions of those functions In the Interests of encouraging good design and saving you from having to rewrite your programit we find it poorly written et me outline what main will do Define variables for the rear and vector. No, don't open the stream here Call a function to open the stream. It will ask the user for allename. If the filename fais, repeatedly ask for a new one until you succeed. If opening the stream object fails, you will need to call the clear method on the stream before attempting to open it again. By the time this function is done, the stream should be open. It does not need to return anything. Call a function to fill the vector from the stream. Pass in the vector and the stream. Do not return anything Call a function to sort the vector in place Call a function to display the vector In addition to the functions directly called by main, Ita couple of other functions would make the overall code easier to read A function to insert the information for a name, carbon count and hydrogen count into the vector A function to find the location of a formula object that matches the number of hydrogene and carbons for a new entry. It will have to retum a suitable value there is no such formale entry in the vector yet. This function would obviously be called by the one in the previous bullet We want to track all of the names of the forme. It would not be very useful if we were to build up a long string of all the names head what makes sense? We want a collection of the all of the names for each formula, not a single string Simple le lepu Stev e Here's a line of code to be called to win the detail and op e e check the fe if we do code should code didat work. To from th lherwise o p ying ingles cor de & Each molecular formula wil be kept in a struct with three fields: the namels) for formula. Note that is a collection of names . the number of carbon atoms . the number of hydrogen atoms We will be storing all these structs in a vector An example Suppose this is the file: n-Butane C4H10 Propyne (313 1,3-Butadiyne C4H2 Hexane C6H14 Butane C4H10 iso-Butane C4H18 Pentane C5H12 Your program should store these five entries and then display: Propyne C4H2 1,3-Butadiyne C4H10 1-Butane Butane iso-Butane C5H12 Pentane C6H14 Hexane The collection has been sorted by number of carbons and then the number of hydrogens. I assume you know from data structures how to write some simple sort algorithm, e.g. bubble sort, selection sort or insertion sort. (Yes, in general these nun in quadratic time, but we don't want you spending a lot of time implementing a more effecient sort) Write a function that will be passed your collection and modify it so that it is sorted Notes As always, write good clean code. What does that mean? . Good use of functions to make code more readabile . Good naming of everything No long lines. What's long? Anything over 80 characters. And now that you know about function prototypes (if not covered in your lecture section look it up in the notes or ask in lab), there should first be one for each i of your functions other than main, then the definition of main, and then the definitions of those functions. in the interests of encouraging good design (and saving you from having to rewrite your program we find it poorly written let me outine what main wil do Define variables for the stream and vector. No, don't open the stream here. Call a function to open the stream. It will ask the user for a filename. If the filename fails, repeatedly ask for a new one until you succeed. If opening the Stream object fails, you will need to call the clear) method on the stream before attempting to open it again. By the time this function is done, the stream should be open. It does not need to retum anything, Cala function to fill the vector from the stream. Pass in the vector and the stream. Do not retun anything Calla function to sort the vector, in place. . Cal a function to display the vector In addition to the functions directly called by main, it a couple of other functions would make the overal code easier to read A function to insert the information for a name, carbon court and hydrogen count into the vector . Atunction to find the location of a formula object that matches the number of hydrogene and carbons for a new entry. I will have to retum asutable value there is no such formala entry in the vector yet. This function would obviously be called by the one in the previous bullet We want to track all of the names of the formulae. I would not be very useful if we were to build up a long string of all the names. Instead what makes sense We want a colection of the all of the names for each formula, not a single string. Each molecular formule will be kept in a struct with the fields the names for formula Note that is a collection of names . the number of carbon atoms the number of hydrogen soms We will be storing these structs in a vector An example Suppose this is the files -Butane CH10 Propyne C3H3 1,3-Butadiyne C4H2 Hexane C6H14 Butane CH10 iso-Butane C4H10 Pentane CSH12 Your program should store these five entries and then display: C33 Propyne C4HQ 1,3-Butadiyne C4H10 n-Butane Butane iso-Butane C5H12 Pentane C6H14 Hexane The collection has been sorted by number of carbons and then the number of hydrogen assure you know from data structures how to write some simple sort algorit , og bubble sort, selection sort or insertion sorte r hese run in quadras time, but we don't want you spending a lot of time Implementing a more effectent sort.) Write a function that will be passed your collection and modity that it is sorted Notes As always, write good clean code. What does that mean? Good use of functions to make code more readable. . Good naming of everything No long lines. What's long? Anything over 80 characters. And now that you know about function prototypes of not covered in your lecture section took it up in the notes or ask in labi. there should first be one for each of your functions other than main, then the definition of main, and then the definitions of those functions In the Interests of encouraging good design and saving you from having to rewrite your programit we find it poorly written et me outline what main will do Define variables for the rear and vector. No, don't open the stream here Call a function to open the stream. It will ask the user for allename. If the filename fais, repeatedly ask for a new one until you succeed. If opening the stream object fails, you will need to call the clear method on the stream before attempting to open it again. By the time this function is done, the stream should be open. It does not need to return anything. Call a function to fill the vector from the stream. Pass in the vector and the stream. Do not return anything Call a function to sort the vector in place Call a function to display the vector In addition to the functions directly called by main, Ita couple of other functions would make the overall code easier to read A function to insert the information for a name, carbon count and hydrogen count into the vector A function to find the location of a formula object that matches the number of hydrogene and carbons for a new entry. It will have to retum a suitable value there is no such formale entry in the vector yet. This function would obviously be called by the one in the previous bullet We want to track all of the names of the forme. It would not be very useful if we were to build up a long string of all the names head what makes sense? We want a collection of the all of the names for each formula, not a single string Simple le lepu Stev e Here's a line of code to be called to win the detail and op e e check the fe if we do code should code didat work. To from th lherwise o p ying ingles cor de & Each molecular formula wil be kept in a struct with three fields: the namels) for formula. Note that is a collection of names . the number of carbon atoms . the number of hydrogen atoms We will be storing all these structs in a vector An example Suppose this is the file: n-Butane C4H10 Propyne (313 1,3-Butadiyne C4H2 Hexane C6H14 Butane C4H10 iso-Butane C4H18 Pentane C5H12 Your program should store these five entries and then display: Propyne C4H2 1,3-Butadiyne C4H10 1-Butane Butane iso-Butane C5H12 Pentane C6H14 Hexane The collection has been sorted by number of carbons and then the number of hydrogens. I assume you know from data structures how to write some simple sort algorithm, e.g. bubble sort, selection sort or insertion sort. (Yes, in general these nun in quadratic time, but we don't want you spending a lot of time implementing a more effecient sort) Write a function that will be passed your collection and modify it so that it is sorted Notes As always, write good clean code. What does that mean? . Good use of functions to make code more readabile . Good naming of everything No long lines. What's long? Anything over 80 characters. And now that you know about function prototypes (if not covered in your lecture section look it up in the notes or ask in lab), there should first be one for each i of your functions other than main, then the definition of main, and then the definitions of those functions. in the interests of encouraging good design (and saving you from having to rewrite your program we find it poorly written let me outine what main wil do Define variables for the stream and vector. No, don't open the stream here. Call a function to open the stream. It will ask the user for a filename. If the filename fails, repeatedly ask for a new one until you succeed. If opening the Stream object fails, you will need to call the clear) method on the stream before attempting to open it again. By the time this function is done, the stream should be open. It does not need to retum anything, Cala function to fill the vector from the stream. Pass in the vector and the stream. Do not retun anything Calla function to sort the vector, in place. . Cal a function to display the vector In addition to the functions directly called by main, it a couple of other functions would make the overal code easier to read A function to insert the information for a name, carbon court and hydrogen count into the vector . Atunction to find the location of a formula object that matches the number of hydrogene and carbons for a new entry. I will have to retum asutable value there is no such formala entry in the vector yet. This function would obviously be called by the one in the previous bullet We want to track all of the names of the formulae. I would not be very useful if we were to build up a long string of all the names. Instead what makes sense We want a colection of the all of the names for each formula, not a single string