problem returning arrays from function to send to a function


# include <iostream>
# include <iomanip>
# include <Windows.h>
# include <string>
# include <cstdlib>
# include <sstream>

using namespace std;

//Function Prototypes
void splashscreen();
int menu();
void additems();
void printreport(std::string, int, int);





int main()
{
//Variable Declarations
int choice; // user choice
const int add = 1;
const int view = 2;
const int exit = 3;
const int size = 3;
string array1[size];
int array2[size];
int array3[size];

//Function Calls
splashscreen();
choice = menu();

switch (choice)
{
case add:
array1*, array2*, array3* = additems();
break;
case view:
printreport(array1*, array2*, array3*);
break;
case exit:
system("cls");
cout << "Have A Great Day" << endl;
cout << endl;
cout << endl;
cout << endl;
cout << "This Program was Created By:" << endl;
cout << "Jonathon Clase" << endl;
EXIT_SUCCESS;
}





return 0;
}


void splashscreen()
{
system("color f0");
cout << "---------------Airport Database---------------" << endl;
cout << endl;
cout << endl;
cout << "This program is designed to keep track of" << endl;
cout << "airport information" << endl;
system("pause");
system("cls");
}
/************************* menu **************************
NAME:menu
PURPOSE:to show the user the menu options
CALLED BY: main
INPUT: none
OUTPUT: the users choice an int
****************************************************************************/
int menu()
{
//Declare Variable for user choice
int choice;
const int add = 1;
const int view = 2;
const int exit = 3;

system("color f0");
cout << "---------------Airport Database---------------" << endl;
cout << endl;
cout << endl;
cout << "1.Add Airports" << endl;
cout << "2.View a Report" << endl;
cout << "3.Exit" << endl;
cin >> choice;

//Validate user choice
while (choice < add || choice > exit)
{
cout << "!Error Please enter 1, 2, or 3" << endl;
cin >> choice;
}

//return users choice
return choice;
}
/
void additems()
{
system("pause");
system("cls");
const int size = 3;
string array1[size];
int array2[size];
int array3[size];
int n = 0;
for (n = 0; n < size; n++)
{
cout << "Please enter the Airport ID name: " << "#" << (n+1) << endl;
cin >> array1[n];
cout << "Please enter the Elevation: " << "#" << (n+1) << endl;
cin >> array2[n];
cout << "Please enter the Runway Length: " << "#" << (n+1) << endl;
cin >> array3[n];
}
system("pause");
system("cls");
menu();
}
void printreport(std::string, int, int)
{
const int size = 3;
string array1[size];
int array2[size];
int array3[size];
cout << "---------------Airport Database---------------" << endl;
cout << "----------------------------------------------" << endl;
cout << "Airport----Elevation(ft)----Runway Length(ft)" << endl;
cout <<"--" << array1[0] << "---------" << array2[0] << "---------------" << array3[0] << endl;
cout <<"--" << array1[1] << "---------" << array2[1] << "---------------" << array3[1] << endl;
cout <<"--" << array1[2] << "---------" << array2[2] << "---------------" << array3[2] << endl;
system("pause");
system("cls");
menu();
}




I cannot get this to work. These are the requirements fro the program ::
I have looked everywhere....

Create a simple program to track airport information.
Keep track of three pieces of information in parallel arrays: airport identifier, airport elevation, and length of longest runway.
Use a constant to define array size. Make it small (3) . It's a small database right now! <wink>
In a menu function, create a menu of options: (1) Add airports, (2) View a report, (3) Exit. Validate the user's entry before continuing. Return the answer to main. The #3 Exit should be the only way to exit from the program. (Do not offer an option at other places in the program.)
Create an addItems function to get all 3 items of data from the user and enter it into the array. (When you send an array to a function, what all do you have to send?) -- You're going to fill the database in this function. Have user enter all data from the keyboard.
Sample data you may use OR you can go to http://fltplan.com and click FBO & airport info on the left:
FNT, 782, 7848
DEN, 7434, 16000
D95, 836, 3800 (this is Lapeer Dupont airport, by the way)
Create a viewReport function that will display the data in the format listed below.
Test your program to be sure it works. Test for mistakes.
Airport Database
--------------------------------
Airport Elevation (ft) Longest runway (ft)
KXXX xxx xxxxx
you've got a lot going on here. For starters, look at the list of pointers you've created. you need a data type for them. also, remember that the syntax is [data type] * [variable name]. if you have to keep declaring each array in every function, consider using a global function. also, why are you system"pause" on your splash screen? just display your menus.
Topic archived. No new replies allowed.