Problem with functions

Ok so i did my program down to the letter but now i need to incorporate Functions to find the cost for each cargo category but can only use ONE function.
I know its probably simple but can someone help me.

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

int main ()
// variables for company name, order input, costs and captian name
const string companyName="Student's name Here";
int fuelPod, protonAmmo, jetpack, oxygen, idNumber=1;
double fuelCost=125.50, fuelPodTotal, ammoCost=17.20, ammoTotal, jetpackCost=99.00,jetpackTotal, oxygenCost=50.40, oxygenTotal, totalCost;
string captian;
//display company welcome prompt

cout << "Welcome to " << companyName << " Space Travel Company." << endl;
//begin while loop for data input and display
//prompt for spaceship number

cout << "Please enter Spaceship Identification or -999 to Terminate: " ;
//read in number, terminate if -999

cin >> idNumber;
while (idNumber!=-999)
//read in captian name, fuel pod, proton cannon ammon, jetpack and oxygen order
cout << "Please Enter the Captain's Name: ";
cout << "Please Enter Fuel Pod Sales: ";
cin >> fuelPod;
cout << "Please enter Proton Cannon Ammo Sales: ";
cin >> protonAmmo;
cout << "Please enter Jetpack Sales: ";
cin >> jetpack;
cout << "Please enter Oxygen Sales: ";
cin >> oxygen;
cout <<endl;
//display sales statement header, spaceship ID number and captians name
cout << companyName << " Space Travel Company Sales Statement." <<endl;
cout << "Spaceship Identification Number "<<idNumber<<endl;
cout << "Captain's Name: "<<captian<<endl;
cout << "*************************************************"<<endl;
// assignment statements for cost of fuelpod,proton cannon ammon, jetpack and oxygen and total cost
// display subtotal for 4 items ordered and total cost of all items
cout << fixed <<setprecision(2)<<showpoint;

cout << setw(30)<<left<<"Cargo"<<setw(12)<< left<<"Sales Amount"<< setw(13)<<right<< "Cost"<<endl;

cout << setw(30)<<left<<"Fuel Pod"<<setw(2)<<left<<fuelPod<<setw(15)<<left
<< "pods"<<setw(8)<<right<<fuelPodTotal<<endl;

cout << setw(30)<<left<<"Proton Cannon Ammunition"<<setw(5)<<left<<protonAmmo<<setw(12)<<left

cout << setw(30)<<left<<"Jetpack"<<setw(2)<<left<<jetpack<<setw(15)<<left<<"jetpacks"

cout << setw(30)<<left<<"Oxygen"<<setw(2)<<left<<oxygen<<setw(15)<<left<<"tanks"

cout << "_________________________________________________________"<<endl;

cout << setw(30)<< left<< "Total Due"<<setw(25)<<right<<totalCost<<endl;

cout << "========================================================="<<endl;

cout << "Please enter Spaceship Identification or -999 to Terminate: " ;

cin >> idNumber;

if (idNumber==-999)
{cout << "Program Teriminating" <<endl;}
system ("pause");
return 0;
Topic archived. No new replies allowed.