C++ Programming
4. a) a a Fig. 4-B below describes main program that invokes function readAndStore InternApplicantRecords () to: read in intern applicant's data stored in a file with the filename that was passed in as argument extract the relevant pieces of information like name, university, email, etc of each applicant stored in the file (Hint: make use of the function splitStrTovecofstr() in Qn 2) initialize a InternApplicantType struct variable with the applicant's name, university, email, currentGPA, and is Local data (Hint: function strto Primitive () in Qn 3 can also be used to help you!) store the InternApplicantType variable info into a vector retum a vector
which contains the data of each applicant found in the file Based on the sample contents of file "InternApplicant.txt" in Fig. 4-A, assuming both splitstrtovecofstr() from Qn 2 and strtoPrimitive () in Qn 3 are available in the main() program in Fig. 4-B, and the sample output as shown in Fig. 4-C, write the implementation code for the function readAndstoreInternApplicant Records () based on the function prototype signature as shown below: vector readAndStore InternApplicantRecords (string filename) (6 marks) (6 marks) b) Implement the toString() for struct InternApplicant, such that the program's output will appear as shown in Fig. 4-C, based on the sample contents of file "InternApplicant.txt" in Fig. 4-A (4 marka) name; university; email;current GPA; is Local Robert Downey Jr;University of California;ironman@stark.com;3.8;0 Scarlett Johansson; University of Marvel;blackwidow@shield.com;3.6;1 Chris Evans; University of New York; captain america.com;3.3;0 Samuel L Jackson; University of Washington;nickfury@shield.com;3.3;1 Fig. 4-A #include #include costream> #include #include #include Fig. 4-B using namespace std; struct InternApplicant { string name, university, email; float current GPA; bool is Local; string toString(); // readAndStoreInternApplicant Records (string filename); Assuming the code for splitstrTovecofstr() and strto Primitive) are implemented here! int main() string filename = "InternApplicant.txt": vector InternApplicantRecs = readAndstoreInternApplicant Records (filename); for (int i=0; i which contains the data of each applicant found in the file Based on the sample contents of file "InternApplicant.txt" in Fig. 4-A, assuming both splitstrtovecofstr() from Qn 2 and strtoPrimitive () in Qn 3 are available in the main() program in Fig. 4-B, and the sample output as shown in Fig. 4-C, write the implementation code for the function readAndstoreInternApplicant Records () based on the function prototype signature as shown below: vector readAndStore InternApplicantRecords (string filename) (6 marks) (6 marks) b) Implement the toString() for struct InternApplicant, such that the program's output will appear as shown in Fig. 4-C, based on the sample contents of file "InternApplicant.txt" in Fig. 4-A (4 marka) name; university; email;current GPA; is Local Robert Downey Jr;University of California;ironman@stark.com;3.8;0 Scarlett Johansson; University of Marvel;blackwidow@shield.com;3.6;1 Chris Evans; University of New York; captain america.com;3.3;0 Samuel L Jackson; University of Washington;nickfury@shield.com;3.3;1 Fig. 4-A #include #include costream> #include #include #include Fig. 4-B using namespace std; struct InternApplicant { string name, university, email; float current GPA; bool is Local; string toString(); // readAndStoreInternApplicant Records (string filename); Assuming the code for splitstrTovecofstr() and strto Primitive) are implemented here! int main() string filename = "InternApplicant.txt": vector InternApplicantRecs = readAndstoreInternApplicant Records (filename); for (int i=0; i