×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Create A Program to Implement Dynamic Allocation of Memory in C++ Assignment Solution

June 29, 2024
Dr. Amanda Lee
Dr. Amanda
🇬🇧 United Kingdom
C++
Dr. Amanda Lee, holding a Ph.D. in Computer Science from the University of London, is a highly respected figure in the field of C++ programming. With over a decade of experience, Dr. Lee has completed over 1000 C++ assignments, showcasing her exceptional skills and commitment to delivering outstanding results for her clients.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Use Python libraries effectively by importing only what you need. For example, if you're working with data, using libraries like pandas and numpy can save time and simplify complex tasks like data manipulation and analysis.
News
In 2024, the Biden-Harris Administration has expanded high-dosage tutoring and extended learning programs to boost academic achievement, helping programming students and others recover from pandemic-related setbacks. These initiatives are funded by federal resources aimed at improving math and literacy skills​

Instructions

Objective
Write a C++ assignment program to implement dynamic allocation of memory.

Requirements and Specifications

program to implement dynamic allocation of memory in C++
program to implement dynamic allocation of memory in C++ 1

Source Code

#pragma once

#include <string.h>

using namespace std;

class Person {

private:

string myName;

int myAge;

bool superHero;

double myLastMeal;

public:

bool super;

// CREATING GETTERS AND SETTERS//

void setname(string name) {

this->myName = name;

}

string getname() {

return myName;

//Some Constructors//

}

void setage(int age) {

this->myAge = age;

}

int getAge() {

return myAge;

}

void setSuper(int super) {

this->superHero = super;

}

bool getSuper() {

return superHero;

}

void setMeal(double meal) {

this->myLastMeal = meal;

}

double getMeal() {

return myLastMeal;

}

string changeName() {

string name2 = "Harold";

this->myName = name2;

return myName;

}

int changeAge() {

this->myAge = 42;

return myAge;

}

double changeMeal() {

this->myLastMeal = 371.48;

return myLastMeal;

}

bool changeSuper() {

if (superHero == 1) {

this ->superHero = 0;

}

if (superHero == 0) {

this ->superHero = 1;

}

return superHero;

}

};

Related Samples

Delve into our C++ Assignments samples, offering insights into topics such as classes, inheritance, pointers, and algorithms. These meticulously crafted solutions serve as invaluable resources for students navigating C++ programming challenges, fostering comprehension and boosting academic success.