subject
Engineering, 10.12.2020 09:20 josht7806

#include #include
using namespace std;

class person //user-defined string type
{
private:
char* str; //pointer to string
public:
person(char* s) //constructor, one arg
{
int length = strlen(s); //length of string argument
str = new char[length+1]; //get memory
strcpy_s(str, length+1, s); //copy argument to it
}

~person() //destructor
{
cout << "Deleting str.\n";
delete[] str; //release memory
}
void dspName() //display the String
{
cout << "name: " << str << endl;
}
};
int main()
{
char str [] = "El chapo";
char* pstr = str;

person s1 (pstr);
s1.display(); //display string

return 0;
}

Modify the person class above to include the person’s age.
Modify the one-argument constructor to accept a new argument, the person’s age.
Implement a function or modify the existing one to display the person’s age.
Display the person’s name and age in a readable format

ansver
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, salazjlove
Which of the following refers to refers to how well the control system responds to sudden changes in the system. a)-transient regulation b)- distributed regulation c)-constant regulation d)-steady-state regulation
Answers: 1
image
Engineering, 04.07.2019 18:10, oshawn108
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg. k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m. k
Answers: 2
image
Engineering, 04.07.2019 18:20, sarah7984
Vibration monitoring this technique uses the noise or vibration created by mechanical equipment and in seme cases by plant systems to detemine their actual condtion. a)- true b)- false
Answers: 2
image
Engineering, 04.07.2019 18:20, Doogsterr
For each of the following process: a) sketch the p-v diagram, b)sketch t-s diagram, c) sketch t-v diagram, d) sketch the boundary work on one of the diagrams (a, b or c) and e) sketch the reversible heat transfer on one of the diagrams (a, b or c): 1- isobaric process from compressed liquid to superheated vapor 2- isothermal process from compressed liquid to superheated vapor 3- isentropic process from compressed liquid to superheated vapor
Answers: 3
You know the right answer?
#include #include
using namespace std;

class person //user-defined string type

Questions in other subjects:

Konu
Mathematics, 24.06.2020 03:01