Hi there. I am trying to do a program for school but am getting 4 unresolved external errors having to do with my function call in the main. Please help for the sake of my grades.
//*************************************************************************************************************************************
// Program: Program 3
//
// Purpose: This program reads in sales data from a text file for all divisions in a company.
//
// Input: The program will read data in via text file
//
// Processing: The program will read in the data supplied via text file. It then will call a function getDivision to read in data for one division.
// The program will then call printDivision to output all of the data read in via a while loop. The function will also call addDivision to add all
// divisions sales amounts. Last, the function printCorpSummarry with print the total sales for each quarter.
//
// Output: The program will output each division with their data, as well as the otal sales per quarter, average sales per quarter, and the
// grand total, highest quarter, and lowest quarter.
//
// Author:
// Class: CS2020
// Semester: Fall 2018
//****************************************************************************************************************************************
//Loop to read in each line at a time and print it, as well as add to the corporation
if (infile.is_open())
{
int i = 0;
while (!infile.eof())
{
getDivision(*p2div, infile);
printDivision(*p2div);
addDivision(*p2div, *p2corp);
//***************************************************************************************************************************
//
// Program 3
// Description: Sales Report Program
// Programmer:
// Class: CS2020 Fall 2018
// Function: getDivision
// Process: This function reads in 5 lines of data at a time and assigns it to the pointer
// Parameters: This function requires the pointer to the division to assign each line, and the file used to read data in
// Returns: Nothing
//
//***************************************************************************************************************************
//***************************************************************************************************************************
//
// Program 3
// Description: Sales Report Program
// Programmer: Jagon Ahlborn
// Class: CS2020 Fall 2018
// Function: printDivision
// Process: This function prints the 5 lines of data read in from the file
// Parameters: This function only requires the division pointer because that is all it needs to output
// Returns: Nothing
//
//***************************************************************************************************************************
//***************************************************************************************************************************
//
// Program 3
// Description: Sales Report Program
// Programmer:
// Class: CS2020 Fall 2018
// Function: addDivision
// Process: This function adds the division to a running total to be used in the corportation structure
// Parameters: This function requires the division pointer so it can add its components to the Corporation pointer
// Returns: Nothing
//
//***************************************************************************************************************************
//***************************************************************************************************************************
//
// Program 3
// Description: Sales Report Program
// Programmer:
// Class: CS2020 Fall 2018
// Function: printCorpSummarry
// Process: This function outputs the corp totals, average quarterly sales, and the total sales. It also finds the highest
// grossing quarter, as well as the lowest grossing quarter
// Parameters: This function requires the corporation pointer to output its information
// Returns: Nothing
//
//***************************************************************************************************************************
code tags <> in the little editor thingy are appreciated in the future.
I see one issue. There is a thing called overloading in c++, where you can have 2 functions with the same name but different parameters, for example:
void foo(int x)
void foo(string s)
a division and a division pointer are NOT the same, so they don't match, and the compiler is confused. While it isn't required, it is very safe and self-defensive coding to just copy the function from the definition (where the code for it is) to make the prototype.
that would give you
void getDivision(Division* p2div, ifstream &infile); //named variables in the header are ok.