Create the Student class in C++. Each student should have a level (initially is
ID: 3744743 • Letter: C
Question
Create the Student class in C++. Each student should have a level (initially is 0) Create the main method, create an object of the Student class in dynamic memory Use cout to print your object. Create a function rank student that receives a pointer to a Student object and increase the rank of the Student object by 1. Use cout to print the object after calling the rank_student function over the object.Explanation / Answer
#include using namespace std; // 1. Student class class Student { public: int level; Student() { level = 0; } }; // 4. rank_student to increase rank of student void rank_student(Student *s) { s->level++; } int main() { // 2. dynamically create student Student *s = new Student; // 3. cout to print object coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.