Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899