help

I AM GETTING ERROR WHEN I CALL INT MENU.
can someone please look at my code and help me!!!

#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <stdlib.h>
#include <conio.h>

using namespace std;
// function prototypes
float menu (float currentSales (int twoDArray[ ][30], float oneDArray[]));
void loadSeats(int twoDArray[][30]);
void loadPrices(float oneDArray[]);
float displaySeatingChart (float [][30], float oneDArray[ ]);


//void savePrices(float [ ]) – Saves the current row prices to the file
//“rowPrices.dat”
//void saveSeats(char [ ][30]) – Save the current seating chart to the file
//“seatingChart.dat


int main ()
// declaring variable
{ int choice;
float currentSales = 0;
const int ARRAYCOLUMN = 30;
const int ARRAYROWS = 15;




float oneDArray[ARRAYROWS];
int twoDArray[ARRAYROWS][ARRAYCOLUMN];

// trying to load
// loading seats

loadSeats(twoDArray);
loadPrices(oneDArray);


// calling menu
choice = menu(currentSales, twoDArray[][30], oneDArray[15]);




return 0;
}


float menu (int choice, int twoDArray[ ][30], float oneDArray[])

{
int choice = 0;

while (choice != 4)
{


cout << "*** Main Menu ***" << endl;
cout << "*** Sales This Session " << "<$" << currentSales << ">" << "***" << endl;

cout << "1. Display Seating Chart" << endl;
cout << "2. Purchase Tickets" << endl;
cout << "3. Change Ticket Prices" << endl;
cout << "4. Exit" << endl;
cout << "Enter Choice: ";
cin >> choice;


switch (choice)
{
case 1: displaySeatingChart (twoDArray, oneDArray) ;
break;

case 2: ;
break;

case 3: ;
break;

case 4: break;

default: cout << "*** Invalid Choice ***" << endl;
system ("pause");
system ("cls");
}
}


return choice;
}

//
void loadSeats(int twoDArray[][30])
{
const int ARRAYCOLUMN = 15;
const int ARRAYROWS = 30;

fstream seatingFile;
seatingFile.open("seatingChart.dat");

if (!seatingFile)
{
cout << "No Seating File Found. . . " << endl;
cout << "Clearing Seating Chart. . . " << endl;
system ("pause");
system ("cls");
for(int rowNumber = 0; rowNumber < ARRAYROWS ; rowNumber++)
for(int columnNumber = 0; columnNumber < ARRAYROWS ; columnNumber++)
{
twoDArray[rowNumber][columnNumber] = '#';
}
}
else
{
for(int rowNumber = 0; rowNumber < ARRAYROWS; rowNumber++)
for(int columnNumber = 0; columnNumber < ARRAYROWS ; columnNumber++)
{
seatingFile >> twoDArray[rowNumber][columnNumber];
}
seatingFile.close();
}
}



// Loading Row Price File
void loadPrices(float oneDArray[])
{
const int ARRAYROWS = 15;

fstream priceFile;
priceFile.open("rowPrices.dat");

if (!priceFile)
{
cout << "No Price File Found. . . " << endl;
cout << "Setting Default Pricing to <$15 for each row>" << endl;
system ("pause");
system ("cls");

for(int rowNumber = 0; rowNumber < ARRAYROWS ; rowNumber++)
oneDArray[rowNumber] = 15;

}
else
{
for(int rowNumber = 0; rowNumber < ARRAYROWS; rowNumber++)
priceFile >> oneDArray[rowNumber];

priceFile.close();
}
}

float displaySeatingChart (float twoDArray[ ][30], float oneDArray[])
{


for (int rownumber = 0; rownumber<15; rownumber++)
cout << "Row " << rownumber+1 << right << setw (15) << setprecision(2) << oneDArray [rownumber+1] << endl;

}
An array as a parameter when calling a function does not need the bracers. Take out the "[]" and it should fix your problem.
Post your errors, too.
function does not take 3 arguments
1>c:\users\hasu\desktop\study\cis c++\project_002\project_002\project_002.cpp(69): error C2082: redefinition of formal parameter 'choice'
1>c:\users\hasu\desktop\study\cis c++\project_002\project_002\project_002.cpp(76): error C2065: 'currentSales' : undeclared identifier
1>c:\users\hasu\desktop\study\cis c++\project_002\project_002\project_002.cpp(88): error C2664: 'displaySeatingChart' : cannot convert parameter 1 from 'int [][30]' to 'float [][30]'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\hasu\desktop\study\cis c++\project_002\project_002\project_002.cpp(106): warning C4244: 'return' : conversion from 'int' to 'float', possible loss of data
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


But now it's giving me these errors? How can i pass 3 parameters in an argument?
Make the function float, and don't pass three arguments to it. I can't bother read all your code, but you can't enter a float number into an integer.
Also, currentSales seems to be undeclared.
Last edited on
ok, did. This is the code i wrote now,





//Documentation
//At the top of your project you should have a doc box like the following.
// File: driver.cpp
// Project: 2
// Class: CIS 2541 - Fall 2011
//// Date: Ocotober 24, 2011
//For every function you should have one like this.
// Function: void balance (float Cbalance, float Sbalance)
// Parameters: Cbalance - current Checking Balance
// Sbalance - current Savings Balance
// Returns: nothing

#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <stdlib.h>
#include <conio.h>

using namespace std;
// function prototypes
float menu (int choice, int twoDArray[ ][30], float oneDArray[],float currentSales);
void loadSeats(int twoDArray[][30]);
void loadPrices(float oneDArray[]);
float displaySeatingChart (float [][30], float oneDArray[ ]);


//void savePrices(float [ ]) – Saves the current row prices to the file
//“rowPrices.dat”
//void saveSeats(char [ ][30]) – Save the current seating chart to the file
//“seatingChart.dat


int main ()
// declaring variable
{ int choice = 0;
float currentSales = 0;
const int ARRAYCOLUMN = 30;
const int ARRAYROWS = 15;




float oneDArray[ARRAYROWS];
int twoDArray[ARRAYROWS][ARRAYCOLUMN];

// trying to load
// loading seats

loadSeats(twoDArray);
loadPrices(oneDArray);


// calling menu
choice = float (menu(currentSales, twoDArray, oneDArray, currentSales));




return 0;
}


float menu (int choice, float twoDArray[][30], float oneDArray[],float currentSales)

{

while (choice != 4)
{


cout << "*** Main Menu ***" << endl;
cout << "*** Sales This Session " << "<$" << currentSales << ">" << "***" << endl;

cout << "1. Display Seating Chart" << endl;
cout << "2. Purchase Tickets" << endl;
cout << "3. Change Ticket Prices" << endl;
cout << "4. Exit" << endl;
cout << "Enter Choice: ";
cin >> choice;


switch (choice)
{
case 1: displaySeatingChart (twoDArray, oneDArray) ;
break;

case 2: ;
break;

case 3: ;
break;

case 4: break;

default: cout << "*** Invalid Choice ***" << endl;
system ("pause");
system ("cls");
}
}


return float(choice);
}

//
void loadSeats(int twoDArray[][30])
{
const int ARRAYCOLUMN = 15;
const int ARRAYROWS = 30;

fstream seatingFile;
seatingFile.open("seatingChart.dat");

if (!seatingFile)
{
cout << "No Seating File Found. . . " << endl;
cout << "Clearing Seating Chart. . . " << endl;
system ("pause");
system ("cls");
for(int rowNumber = 0; rowNumber < ARRAYROWS ; rowNumber++)
for(int columnNumber = 0; columnNumber < ARRAYROWS ; columnNumber++)
{
twoDArray[rowNumber][columnNumber] = '#';
}
}
else
{
for(int rowNumber = 0; rowNumber < ARRAYROWS; rowNumber++)
for(int columnNumber = 0; columnNumber < ARRAYROWS ; columnNumber++)
{
seatingFile >> twoDArray[rowNumber][columnNumber];
}
seatingFile.close();
}
}



// Loading Row Price File
void loadPrices(float oneDArray[])
{
const int ARRAYROWS = 15;

fstream priceFile;
priceFile.open("rowPrices.dat");

if (!priceFile)
{
cout << "No Price File Found. . . " << endl;
cout << "Setting Default Pricing to <$15 for each row>" << endl;
system ("pause");
system ("cls");

for(int rowNumber = 0; rowNumber < ARRAYROWS ; rowNumber++)
oneDArray[rowNumber] = 15;

}
else
{
for(int rowNumber = 0; rowNumber < ARRAYROWS; rowNumber++)
priceFile >> oneDArray[rowNumber];

priceFile.close();
}
}

float displaySeatingChart (float twoDArray[ ][30], float oneDArray[])
{
float choice1 = 123;

for (int rownumber = 0; rownumber<15; rownumber++)
cout << "Row " << rownumber+1 << right << setw (15) << setprecision(2) << oneDArray [rownumber+1] << endl;

return choice1;
}




and the errors i am getting are


1>------ Build started: Project: project_002, Configuration: Debug Win32 ------
1> project_002.cpp
1>c:\users\hasu\desktop\study\cis c++\project_002\project_002\project_002.cpp(57): warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
1>c:\users\hasu\desktop\study\cis c++\project_002\project_002\project_002.cpp(57): warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>project_002.obj : error LNK2019: unresolved external symbol "float __cdecl menu(int,int (* const)[30],float * const,float)" (?menu@@YAMHQAY0BO@HQAMM@Z) referenced in function _main
1>C:\Users\hasu\Desktop\study\cis c++\project_002\Debug\project_002.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Please help guys
Topic archived. No new replies allowed.