I have the program written but I'm getting a 0 instead of the age I entered.

#include <iostream>

using namespace std;;

//function prototype
void getAge(int);

int main()
{	
	//declare variable
	int age = 0;

	//call function to get the age
	getAge(age);

	//display the age
	cout << "You are " << age << " years old." << endl;

	return 0;
 
}   //end of main function

//*****function definitions*****
void getAge(int years)
{   
	cout << "Enter an age: ";
	cin >> years;
}  //end of getAge function

Try this and see if it works:

//Line #6
void getAge(int&);

//Line #24
void getAge(int& years)
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.