Please follow the instructions and write codes in C++. Write a program that uses a struct named Student to store informa
Posted: Thu Jul 14, 2022 2:19 pm
Please follow the instructions and write codes inC++.
Write a program that uses a struct named Student to storeinformation about a Student. You will be reading from a text inputfile into an array (size 20) of Student structs. The program willcontain the following files:
students.txt - Text file with student information
(1) Build the Student struct with the following specificationsin the files (Student.h and Student.cpp):
You may NOT use strings.
(2) Create the following functions (Student.h andStudent.cpp):
(3) In main() (main.cpp), open the students.txt file and pass tothe loadValues() function to read the student data into the array.Then call the printValues() function to print out the list ofstudents.
(4) Program input and output:
File input, students.txt:
Program output:
Use the setw() and ``left``` manipulators to create columns forprinting - 15 characters for Student First Name and 15 charactersfor Student first Name, and 3 characters for GPA.
(5) Notes:
--------------------------------------------------------------------------------
main.cpp
#include <iostream>#include <cstring>#include <fstream>
#include "Student.h"using namespace std;
int main() {Student studentList[50];int numStudents = 0;ifstream inFile;/* add your code here */return 0;}
--------------------------------------------------------------------------------
Student.cpp
#include "Student.h"using namespace std;
/* add function loadValues() */
/* add function printValues() */
--------------------------------------------------------------------------------
Student.h
#ifndef STUDENT_H#define STUDENT_H#include <fstream>#include <iostream>#include <cstring>#include <iomanip>
using namespace std;
/* Define the Student struct here */
/* Add function prototypes */
#endif
Write a program that uses a struct named Student to storeinformation about a Student. You will be reading from a text inputfile into an array (size 20) of Student structs. The program willcontain the following files:
students.txt - Text file with student information
(1) Build the Student struct with the following specificationsin the files (Student.h and Student.cpp):
You may NOT use strings.
(2) Create the following functions (Student.h andStudent.cpp):
(3) In main() (main.cpp), open the students.txt file and pass tothe loadValues() function to read the student data into the array.Then call the printValues() function to print out the list ofstudents.
(4) Program input and output:
File input, students.txt:
Program output:
Use the setw() and ``left``` manipulators to create columns forprinting - 15 characters for Student First Name and 15 charactersfor Student first Name, and 3 characters for GPA.
(5) Notes:
--------------------------------------------------------------------------------
main.cpp
#include <iostream>#include <cstring>#include <fstream>
#include "Student.h"using namespace std;
int main() {Student studentList[50];int numStudents = 0;ifstream inFile;/* add your code here */return 0;}
--------------------------------------------------------------------------------
Student.cpp
#include "Student.h"using namespace std;
/* add function loadValues() */
/* add function printValues() */
--------------------------------------------------------------------------------
Student.h
#ifndef STUDENT_H#define STUDENT_H#include <fstream>#include <iostream>#include <cstring>#include <iomanip>
using namespace std;
/* Define the Student struct here */
/* Add function prototypes */
#endif