Question: c++ modify code without condensing into one file to get string to work #include #include #include people.h using namespace std; /* classes */ int main()

c++ modify code without condensing into one file to get string to work

#include #include #include "people.h" using namespace std; /* classes */

int main() {

Person p1;

p1.set_age(31); p1.set_name("bob");

cout << "my age is " << p1.get_age() << endl; cout << "my name is " << p1.get_name(); return 0; }

----------------------------------------people.h

#ifndef PEOPLE_H_INCLUDED #define PEOPLE_H_INCLUDED

class Person { private : int age; string name; public : void set_age(int); int get_age(); void set_name(string); string get_name(); };

#endif // PEOPLE_H_INCLUDED

--------------------------------->people.cpp

#include "people.h" #include #include

using namespace std;

void Person ::set_age(int value) { age = value; }

int Person::get_age() { return age; }

void Person::set_name(string info) { name = info; }

string Person::get_name() { return name; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!