I am getting some errors. 4 are C2143 2 of which point to the function prototype void ArrayFunc(int, int, float, int[SIZE][2],float[SIZE],int &,int &); and the other 2 C2143 errors point to void ArrayFunc (int count, int hours, float total, int array1[][2], float array2[], int &row, int &column) (the function definition). Also there are 4 C2059 errors that direct me to the same lines as the C2143 errors. Please help me with this problem, someone.
#include <stdio.h>
#define SIZE 10
void PrintHeading (void);
void PrintValues (int, int, float);
float CalcVal (int);
void ArrayFunc (int, int, float, int[SIZE][2],float[SIZE],int &,int &);
char ReadChoice(void);
int ReadHours(int hours);
void PrintArray(int [SIZE][2], float[SIZE]);
int main (void)
{
int count=0; //counter
int hours=0; //hours
char choice; //users choice for continuing
float total=0; //total charge
int array1[SIZE][2]={0}; //holding customer number and hours
float array2[SIZE]={0}; //holding customer total
int row = 0, column = 0; //
do
{
//assinging customer number
count++;
hours=ReadHours(hours);
total=CalcVal(hours);
ArrayFunc(count,hours,total,array1, array2,row,column);
PrintHeading();
PrintValues(count, hours, total);
choice = ReadChoice();
} while (choice=='y' || choice=='Y');
PrintArray(array1,array2);
return 0;
}
void PrintHeading(void)
{
//print display
printf ("%-15s %-10s %-10s","Customer","Hours","Total Charge\n");
}
void PrintValues(int count, int hours, float total)
{
//print display
printf ("%-15d %-10d %5c %-10.2f\n", count, hours, '$',total);
}
float CalcVal(int hours)
{
//begin loop for repetition
float total=0;
if (hours<3 && hours>0)
total=2;
else
if (hours>=19 && hours<=24)
total = 10;
else
if (hours > 3 && hours < 19)
total = (hours-3)*.5 + 2;
else
if (hours > 24)
printf ("Invalid Entry...Try Again");
//need to repeat if entry is incorrect
return total;
}
void ArrayFunc (int count, int hours, float total, int array1[][2], float array2[], int &row, int &column)
{
//storing customer information inside arrays MAKE A FUNCTION AND PRINT ARRAY OUT THAT NEEDS TO BE IN A SEPERATE FUNC
array1[row][column++] = count;
array1[row][column] = hours;
array2[row] = total;
row++; //change to next row in array
column=0; //reset to first column in 2-D array
}
char ReadChoice(void)
{
char choice;
//ask if user wants to continue
printf ("Would you like to continue? y=yes n=no\n");
scanf ("%*c%c",&choice);
return choice;
//end of loop
}
int ReadHours(int hours)
{
//ask for # of hours
printf("Please enter # of hours:\n\n");
scanf ("%d",&hours);
return hours;
}
void PrintArray(int array1[] [2], float array2[])
{
int row=0, column=0;
//print array findings
PrintHeading();
for( ; row<=SIZE; row++)
{
column=0;
printf ("%-15d %-10d %5c %-10.2f\n", array1[row] [column], array1[row] [column], array2[row]);
}
}