pathfinder
New Member
So I am working on this assignment for school and having a strange issue.
I would, ofc, rather use a different function for every question to get the user input separately, however my professor is requiring we use a 'void' function to retrieve several inputs (I think this is called 'pass by reference').
That actually is not giving an error code, but the output.cpp file is! Strange..
This is the declaration of the function, above 'int main()':
The header (or definition?) of the actual code (WHERE THE ERROR IS):
Next is the code to call the function:
And finally, the actual function itself, along with a verbatim copy of the error I am receiving. Also I am using Netbeans with mingw if that is relevant.
THE ERROR CODE when trying to compile:
It says this for every line I posted in the second box.
Now, I have tried switching things all over the place--including adding the data type before each variable--but I'm new to functions (and CPP in general) so if anyone can shed some light here, it would be greatly appreciated.
I would, ofc, rather use a different function for every question to get the user input separately, however my professor is requiring we use a 'void' function to retrieve several inputs (I think this is called 'pass by reference').
That actually is not giving an error code, but the output.cpp file is! Strange..
This is the declaration of the function, above 'int main()':
PHP:
void OutputInvoice (int accountNumber ,
string countyName ,
int dateDay ,
int dateMonth ,
int dateYear ,
float initialSale ,
float discount ,
float salesTax ,
float shippingCost ,
float saleAmount );
The header (or definition?) of the actual code (WHERE THE ERROR IS):
PHP:
OutputInvoice (accountNumber ,
countyName ,
int dateDay ,
int dateMonth ,
int dateYear ,
float initialSale ,
float discount ,
float salesTax ,
float shippingCost ,
float saleAmount );
Next is the code to call the function:
PHP:
OutputInvoice (accountNumber ,
countyName ,
int dateDay ,
int dateMonth ,
int dateYear ,
float initialSale ,
float discount ,
float salesTax ,
float shippingCost ,
float saleAmount );
And finally, the actual function itself, along with a verbatim copy of the error I am receiving. Also I am using Netbeans with mingw if that is relevant.
PHP:
{
cout << left;
cout << setw(20) << "ACCOUNT NUMBER";
cout << setw(20) << "COUNTY\n";
cout << setw(10) << accountNumber;
cout << setw(20) << countyName << endl;
cout << "DATE OF SALE: ";
cout << dateMonth << "/" << dateDay << "/" << cout << dateYear;
cout << endl << endl << endl << endl;
cout << setw(20) << "$" << setprecision(3);
cout << initialSale;
}
THE ERROR CODE when trying to compile:
PHP:
error: expected primary-expression before 'int'
Now, I have tried switching things all over the place--including adding the data type before each variable--but I'm new to functions (and CPP in general) so if anyone can shed some light here, it would be greatly appreciated.
Last edited: