the code following this is my project. The getInfo() function will not return the information, that is one problem i have having. also anyone have a suggestion for a search function for this?

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

/////////////
//Prototypes
/////////////
void menu(int&);
void getInfo(string[], int[], string[], int[], int, const int);
void search();
void disSearch();
void disReport(string[], int[], string[], int[], const int);
void releaseInfo();


int main()
{
        //Variables
        int choice;
        const int MAX = 2;
        string guestName[MAX];
        int claimNum[MAX];
        string bellName[MAX];
        int numBag[MAX];


        //This will be the menu that contains the choices of storing
        //releasing or viewing reports.
        menu(choice);
        if(choice == 1)
        {
                getInfo(guestName, claimNum, bellName, numBag, choice, MAX);
        }
        else if (choice == 2)
        {
                search();
        }
        else if (choice == 3)
        {
                search();

               releaseInfo();
        }
        else if (choice == 4)
        {
                disReport(guestName, claimNum, bellName, numBag, MAX);
        }
        else if (choice == 5)
        {
                return 0;
        }
        else
        {
                cout << "Error!" << endl;
        }
        main();
        search();
        releaseInfo();
        return 0;
}

///////////
//Functions
///////////


//these will contain the information to run the program.



void menu(int& tempChoice)
{
        // getting users choice for program

        cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
        cout << "~~~~~~~~~~~~~~~~~~Menu~~~~~~~~~~~~~~~~~~~~~" << endl;
        cout << "1. Store luggage " << endl;
        cout << "2. Find luggage " << endl;
        cout << "3. Release luggage " << endl;
        cout << "4. View Totals Reports " << endl;
        cout << "5. Exit.                " << endl;
        cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
        cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
        cin >> tempChoice;

        while (tempChoice < 1 || tempChoice > 5)
        {
                cout << " Please choose 1, 2, 3, 4, or 5. " << endl;
                cin >> tempChoice;
        }
}

void getInfo(string tempguestName[], int tempclaimNum[], string
tempbellName[], int tempnumBag[], int tempchoice, const int MAX)
{

        int i = 0;

        while (tempchoice == 1)
        {
                cout << "Please enter the guest name. " << endl;
                cin >> tempguestName[i];
                cout << "Please enter the claim number." << endl;
                cin >> tempclaimNum[i];
                cout << "Please put your name. " << endl;
                cin >> tempbellName[i];
                cout << "Please put in how many bags." << endl;
                cin >> tempnumBag[i];
                i++;
                cout << "Press 1 to enter another entry." << endl;
                cin >> tempchoice;
        }

        return;
}


void search()

{


}

void disSearch()

{



}


void disReport(string guestName[], int claimName[], string bellName[], int numBag[$
{
        int i = 0;
        for (i = 0; i < MAX; i++)
        {
                cout << "guest name: " <<  guestName[i]<< endl;
                cout << "Claim Number" << claimName[i]<<endl;
                cout << "staff: " << bellName[i] << endl;
                cout << "number of bags: " <<numBag[i] << endl;
        }

}
void releaseInfo()
{



}

also switches are out this is an intro class and we cant use them.....

You're passing choice by value to the function menu() , I think that you should use:

menu(&choice);

That did not change anything.

You're passing choice by value to the function menu() , I think that you should use:

menu(&choice);

The OP has passed the correct way. He's not after a pointer, it was a reference variable.

@OP: What are you expecting your function to return? You pass in your arrays by pointer but repeatedly write to the first element. You need to increment i somewhere.

You pass in your arrays by pointer but repeatedly write to the first element. You need to increment i somewhere.

I think that i is incremented in the while loop, line 111.

The problem is that you call main() from within main() itself (Line 58). This is likely to produce undefined behaviour. Instead, you should put all you if else statements in a while loop instead. If you want the program to just keep looping, you can use:

while(1){

   /* This code with loop until you stop it with a break or return */

}

I don't think that you should ever call main() in a C++ program.

I think that i is incremented in the while loop, line 111.

I think you're right! Sorry.

Thanks a ton guys, all the advice really helped :)

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.