This lab will explore how to define a new C++ data type and also how to combine multiple C++ files into a single executable program. The lab has the following requirements: • Please make sure all your function must have function header documentation, please see PrintMeFirst function as example. • student.h file: Write a struct Student and save it in student.h file with the following: o struct Student must have the following data field: name of data type string • idNum of data type int • creditHours of data type int gpa of data type double • student.cpp file: o write a function Student getData ( ) that will do the following: • define a local variable Student studentInfo • this function will ask user to enter "Student name" and save the user input to the data member name of local variable studentInfo • this function will ask user to enter "Student ID" and save the user input to the data member idNum of local variable studentInfo this function will ask user to enter "Student name" and save the user input to the data member creditHours of local variable studentInfo • this function will ask user to enter "Student name" and save the user input to the data member gpa of local variable studentInfo return studentInfo o write a function void printStudentīnfo(Student studentInfo) that will do the following: • print out the all the data member of studentInfo printMeFirst.h file: I have provided this file printMeFirst.cpp file: I have provided this file • Makefile file: I have provide this file studentMain.cpp file: This is a test driver program. I have provided this file, but you need to change the parameters for printMeFirst function to your own name and the name of this lab. • After your compile all these programs, it will link into an executable program studentMain Run studentMain program, and it should have a similar output below:

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 5PP: (Data processing) Write a C++ program that reads the file created in Exercise 4, permits the user to...
icon
Related questions
Question

so every time I ask this question and the code that is provided does not compile it gives a "student.h" header file error

can u please fix that and give me the right code that will compile.

programming language is C++

I also provided the code that I get from the tutor it's not compiling.

Lab9: Structure & Makefile
CS-102
2020 Fall Semester
This lab will explore how to define a new C++ data type and also how to combine multiple C++
files into a single executable program.
The lab has the following requirements:
Please make sure all your function must have function header documentation, please
see PrintMeFirst function as example.
student.h file: Write a struct Student and save it in student.h file with the following:
struct Student must have the following data field:
name of data type string
idNum of data type int
creditHours of data type int
gpa of data type double
student.cpp file:
o write a function Student getData ( ) that will do the following:
define a local variable Student studentInfo
this function will ask user to enter "Student name" and save the user input
to the data member name of local variable studentInfo
this function will ask user to enter "Student ID" and save the user input to
the data member idNum of local variable studentInfo
this function will ask user to enter "Student name" and save the user input
to the data member creditHours of local variable studentInfo
this function will ask user to enter "Student name" and save the user input
to the data member gpa of local variable studentInfo
return studentInfo
o write a function void printStudentInfo(Student studentInfo) that will do the
following:
print out the all the data member of studentInfo
printMeFirst.h file: I have provided this file
printMeFirst.cpp file: I have provided this file
Makefile file: I have provide this file
studentMain.cpp file: This is a test driver program. I have provided this file, but you
need to change the parameters for printMeFirst function to your own name and the name
of this lab.
• After your compile all these programs, it will link into an executable program
studentMain
Run studentMain program, and it should have a similar output below:
Transcribed Image Text:Lab9: Structure & Makefile CS-102 2020 Fall Semester This lab will explore how to define a new C++ data type and also how to combine multiple C++ files into a single executable program. The lab has the following requirements: Please make sure all your function must have function header documentation, please see PrintMeFirst function as example. student.h file: Write a struct Student and save it in student.h file with the following: struct Student must have the following data field: name of data type string idNum of data type int creditHours of data type int gpa of data type double student.cpp file: o write a function Student getData ( ) that will do the following: define a local variable Student studentInfo this function will ask user to enter "Student name" and save the user input to the data member name of local variable studentInfo this function will ask user to enter "Student ID" and save the user input to the data member idNum of local variable studentInfo this function will ask user to enter "Student name" and save the user input to the data member creditHours of local variable studentInfo this function will ask user to enter "Student name" and save the user input to the data member gpa of local variable studentInfo return studentInfo o write a function void printStudentInfo(Student studentInfo) that will do the following: print out the all the data member of studentInfo printMeFirst.h file: I have provided this file printMeFirst.cpp file: I have provided this file Makefile file: I have provide this file studentMain.cpp file: This is a test driver program. I have provided this file, but you need to change the parameters for printMeFirst function to your own name and the name of this lab. • After your compile all these programs, it will link into an executable program studentMain Run studentMain program, and it should have a similar output below:
Above is the code snippet for student.h file
Code snippet for student.cpp file -
#include <iostream>
#include "student.h"
using namespace std;
Student getData()
{
Student studentInfo;
cout<<"Enter the following student data:\n";
cout<<"Student name: ";
cin>>studentInfo.name;
cout<<"Student ID Number: ";
cin>>studentInfo.idNum;
cout<<"Credit Hours Enrolled: ";
cin>>studentInfo.creditHours;
cout<<"Currnt GPA: ";
cin>>studentInfo.gpa;
return studentInfo;
}
void printStudentInfo(Student studentInfo)
{
cout<<"Here iis the student data you entered:\n";
cout<<"Name: "«studentInfo.name<<endl;
cout<<"ID Number: "<<studentInfo.idNum<<endl;
cout<<"Credit Hours: "<<studentInfo.creditHours<<endl;
cout<<"GPA: "<<studentInfo.gpa<<endl;
}
int main() {
Student s = getData();
printStudentInfo(s);
return 0;
}
Transcribed Image Text:Above is the code snippet for student.h file Code snippet for student.cpp file - #include <iostream> #include "student.h" using namespace std; Student getData() { Student studentInfo; cout<<"Enter the following student data:\n"; cout<<"Student name: "; cin>>studentInfo.name; cout<<"Student ID Number: "; cin>>studentInfo.idNum; cout<<"Credit Hours Enrolled: "; cin>>studentInfo.creditHours; cout<<"Currnt GPA: "; cin>>studentInfo.gpa; return studentInfo; } void printStudentInfo(Student studentInfo) { cout<<"Here iis the student data you entered:\n"; cout<<"Name: "«studentInfo.name<<endl; cout<<"ID Number: "<<studentInfo.idNum<<endl; cout<<"Credit Hours: "<<studentInfo.creditHours<<endl; cout<<"GPA: "<<studentInfo.gpa<<endl; } int main() { Student s = getData(); printStudentInfo(s); return 0; }
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr