This lab will exercise your understanding of some of the concepts covered in Chapter 12:dynamic data, arrays, pointer addresses 1. Create a structure called students. The structure should contain:firstname, lastname, gpa. 2. Create a pointer to the student structure and dynamically create an array of thestudent structure, enough for 4 students.Hint: Store the address of the beginning of the array 3. Create a file that contains four rows of data with last name, first name and gpa valueor use the inFile.txt file attached. 4. Using pointer notation only (not array notation []), read the data from the file andstore the data into the structure.After all the data is read and stored, using pointer notation only, output to the console (cout)each student's first name, last name and gpa. Use information messages and ensure the datais displayed properly. 5. Before exiting, delete the dynamically allocated structure array.Complete as much as you can before you leave ensuring what you've completed compiles. These labs areentirely for your practice. The program may be named any name of our choice, must have a .cpp extention; variables may be any name of yourchoice.You DO NOT have to comment these programs, however, please include your NAME as a comment in ALL code files.SUBMIT the code (*.cpp). All files must be submitted and the program MUST compile and run to get credit. Input file: Infile.txt - Harper Smith 4.0 Tsia Smith 3.9 Holy Cow 2.8 Gee Whiz 3.0
This lab will exercise your understanding of some of the concepts covered in Chapter 12:dynamic data, arrays, pointer addresses
1. Create a structure called students. The structure should contain:firstname, lastname, gpa.
2. Create a pointer to the student structure and dynamically create an array of thestudent structure, enough for 4 students.Hint: Store the address of the beginning of the array
3. Create a file that contains four rows of data with last name, first name and gpa valueor use the inFile.txt file attached.
4. Using pointer notation only (not array notation []), read the data from the file andstore the data into the structure.After all the data is read and stored, using pointer notation only, output to the console (cout)each student's first name, last name and gpa. Use information messages and ensure the datais displayed properly.
5. Before exiting, delete the dynamically allocated structure array.Complete as much as you can before you leave ensuring what you've completed compiles.
These labs areentirely for your practice.
The
Input file:
Infile.txt
- Harper Smith 4.0
Tsia Smith 3.9
Holy Cow 2.8
Gee Whiz 3.0
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images