Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function to update the address of a person by using call be reference fu

ID: 3545365 • Letter: W

Question

Write a function to update the address of a person by using call be reference function.

Initialize the values of Name (user name), st_num (street number), st_name (street name),City, State and Zip code.

Then accept the new values in function and then display them in main.

The output expected is like this:

This is an example, you can use any address values.

Dear John (user name),

Your address from 115, Huntington Ave, Boston, MA, 0115

has been successfully changed to

New address:

776, West Dallas street, Houston, TX, 70119.

Dear John (user name),

Your address from 115, Huntington Ave, Boston, MA, 0115

has been successfully changed to

New address:

776, West Dallas street, Houston, TX, 70119.

Explanation / Answer

#include <iostream>

#include <string>

using namespace std;


void update(string& name, string& st_num, string& st_name, string& city

, string& state, string& zip)

{

//accept new value

st_num = "776";

st_name = "West Dallas street";

city = "Houston";

state = "TX";

zip = "70119";


}

// the main program

int main()

{

string name = "John";

string st_num = "115";

string st_name = "Huntington Ave";

string city = "Boston";

string state = "MA";

string zip = "0115";

string output = "Dear " + name + ", "

+ "Your addresss from " + st_num

+ ", " + st_name + ", " + city

+ ", " + state + ", " + zip;


update(name, st_num, st_name, city, state, zip);

cout << output << endl;

cout << "has been successfully changed to" << endl;

cout << "New address:" << endl;

cout << st_num << ", " << st_name << ", " << city

<< ", " << state << ", " << zip << endl;


return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote