I have to make a call-by-reference and I already have all of the program and it works I just have a little problem. I don't know how to get the output to say what I want it to say. It needs to give me the street, city and zip that is provided by the operator in the input section. Help would be greatly appreciated! :)

#include <iostream>
#include <string>
using namespace std;

// -------------------------------------------------------
// Function declarations - there will be three function declarations
// here at the end of the lab, and each prototype should have pre-
// and post-condition comments
// Note: The function prototypes will use the data type 'string', which
// is available with the library 'string'.

void input_data (string first_name, string last_name, string street, string city, int zip);
//Reads the information that the operators enters

void output_data (string street, string city, int zip);
//Shows the information typed in by the operator

int main()
{
string first_name, last_name, street, city;
int zip;

input_data (first_name, last_name, street, city, zip);
output_data (street, city, zip);
return 0;
}

//Uses iostream:
void input_data (string first_name, string last_name, string street, string city, int zip)
{
using namespace std;
cout<<"Enter your first name: ";
cin>>first_name;

cout<<"Enter your last name: ";
cin>>last_name;

cout<<"Enter your street: ";
cin>>street;

cout<<"Enter your city: ";
cin>>city;

cout<<"Enter your zip: ";
cin>>zip;
}

void output_data (string street, string city, int zip)

{
using namespace std;
cout<<"This is your address as entered: ";
cout<<street<<" "<<city<<endl;
}

>>void input_data (string first_name, string last_name, string street, string city, int zip);

That is not call by reference -- its call by value. This is call by reference
void input_data (string& first_name, string& last_name, string& street, string& city, int& zip);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.