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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

What is a verb?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago

Question

c. How is trust demonstrated?

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago