1. Download pointers.cpp 2. Write the definition for the init_Student() function
ID: 668079 • Letter: 1
Question
1. Download pointers.cpp
2. Write the definition for the init_Student() function. This function should ask the user for all required information.
3. Write a function to print the students information to the terminal (this function should be called from the main function)
4. Create a copy of pointers.cpp names class_pointer.cpp
5. Rewrite the new file to use a student class instead of struct
6. Adjust all code to comply with class (you should have accessors and mutators)
______________________________________________________________________
pointers.cpp
Explanation / Answer
// Filename: pointers.cpp #include #include using namespace std; struct Student { string name; int id; int* mark; ~Student() { delete mark; }; }; void initStudent(Student* ptr, int size); // function prototype for initialization // function prototype for printing //*********************** Main Function ************************// int main () { Student stu; // instantiating an STUDENT object Student* stuPtr = &stu; // defining a pointer for the object cout mark = new int[size]; for (int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.