OK, I a program that takes in data from a file and returns messages based upon it. Right now my function shot is supposed to be a multiple value returning function but I don't know how to return multiple values because it says that its not a void type variable. Any help on this would be great.


Code:
/Patrick Howard
/*
*/
//May 12, 2010
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
// declared constants
const float PI = 3.14159265f;
const float NUM = 180.0f;
const int AIRCRAFT_CARRIER = 3030; // targets locations in meters
const int BATTLESHIP = 2000; // targets locations in meters
const int DESTROYER = 1900; // targets locations in meters
const int SUBMARINE = 1000; // targets locations in meters
int  pv = 0;//public variable to test to see if it got hit or not
int ahit = 6;
int bhit = 5;
int dhit = 3;
int subhit = 2;
using namespace std;
// functions prototype
float calcRadians(int deg);
float fDistance(float , float vel);
void shot(bool &isHit, float &distance);
void print(string fileName, int falseData, int shots, int hits, int missed, int reload);
int main()
{
	//declare number of hits for each ship
	int aircraftHits = 6; // max number of hits for known targets
	int battleshipHits = 5; // max number of hits for known targets
	int destroyerHits = 3; // max number of hits for known targets
	int submarineHits = 2; // max number of hits for known targets
	int numShots = 0;
	int numHits = 0;
	int misses = 0;
	int rounds = 0;
	int amo = 2;
	ifstream din;
	string name;
	bool hit = false;
	bool badData = false;
	int data = 0;
	int degrees; // the angle in degrees
	float velocity; // the initial velocity
	float radians; // the radians
	float distance; // the distance
	do
	{
		cout << "Please enter the input file name. " << endl; // file name is entered
		cin >> name; // name printed
		din.open(name.c_str()); // file opened
		if(!din.is_open()) // make sure file is real
		{
			cout << name << " is an invalid file name." <<endl; // if not found it will state that the file is invalid
			din.clear();
		}
	}
	while(!din.is_open());
	{

	while(din)
	{
		din >> degrees >> velocity; 
		if(degrees <= 0 && velocity <= 0)
		{
			cout << "Bad data." << endl;
			data ++;
		}
		else if(degrees <= 0)
		{
			cout << "Bad data." << endl;
			data ++;
		}
		else if(velocity <= 0)
		{
			cout << "Bad data." << endl;
			data ++;
		}
		else
		{
			din.ignore(80,'\n');
			radians = calcRadians(degrees);
			//cout << radians << endl;
			distance = fDistance(velocity, radians);
			//cout << distance << endl;
			shot(hit, distance);
			numShots++;
			if(pv == 1)
			numHits ++;
			else
			misses ++;
			amo = amo - 1;
			if(amo == 0)
			{
				rounds++;
				amo = 2;
			}
			pv = 0;
		}
	}
	}
		print(name, badData, numShots, numHits, misses, rounds);//numhits6 misses2
		return 0;
}

float calcRadians(int deg)
{
	float numerator;
	float rad;
	numerator = deg * PI;
	rad = numerator / NUM;
	//cout << rad << endl;
	return rad;
}

float fDistance(float vel,float radians)
{
		float Distance;
		Distance = (float)(((vel * vel)*(sin(2*radians))/32.2));
		//cout << Distance << endl;
		return Distance;
}

void shot(bool &isHit, float &distance)
{
		if(distance >= (AIRCRAFT_CARRIER - 1) && distance <= (AIRCRAFT_CARRIER + 1))
		{
		    isHit = true;
			ahit = ahit - 1;
			pv = 1;
		}
		else if (distance >= (-1 + BATTLESHIP) && distance <= (1 + BATTLESHIP))
		{
			isHit = true;
			bhit = bhit - 1;
			pv = 1;
		}
		else if(distance >= (-1 + DESTROYER) && distance <= (1 + DESTROYER))
		{
			isHit = true;
			dhit = dhit - 1;
			pv = 1;
		}
		else if(distance >= (-1 + SUBMARINE) && distance <= (1 + SUBMARINE))
		{
			isHit = true;
			subhit = subhit - 1;
			pv = 1;
		}
		return;
}
void print(string fileName, int falseData, int  reload, int hits, int missed)//num amo, num hits, num miss, percent, num of lines of bad data
{
		float percentage = 0;
		ofstream dout;
		cout << "Please enter the output file name. " << endl; 
		cin >> fileName;
		dout.open(fileName.c_str());
		percentage = ((float)reload / hits);
		dout << "The number rounds of ammo were expended: " << reload << endl;
		dout << "The total number of hits overall: " << hits << endl;
		dout << "The total number of misses were: " << missed << endl;
		dout << "The percentage of hits to rounds expended: " << percentage << endl;
		dout << "The number of lines of bad data in the file: " << falseData << endl;
		dout.close();
}