When I debug the definitions for all my functions give me missing ')' before constant, and missing ';' before constant. It all looks good to me, just wondering what would make it give me that error and how I might be able to fix it?
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#define size 50
using namespace std;
void headings(ofstream &outFile);
float readData(ifstream &inFile, float customer[], float balance[], float);
void sort(ifstream &inFile, float balance[], float);
void printResults(ofstream &outFile, ifstream &inFile, float customer[], float balance[], float);
int main()
{
//declare variables
float customer[size];
float balance[size];
//open files
ifstream inFile;
ofstream outFile;
inFile.open("prog7.txt");
outFile.open("prog7.out");
// funtion to print headings
headings(outFile);
// read from file
readData(inFile, customer, balance, size);
// function to sort in descending order
sort(inFile, balance, size);
// function to print results
printResults(outFile, inFile, customer, balance, size);
// close files
outFile.close();
inFile.close();
return 0;
}
void headings(ofstream &outFile)
{
outFile <<setw(10)<< "Customer ID"
<<setw(10)<< "Balance"
<<endl;
}
float readData(ifstream &inFile, float customer[], float balance[], float size)
{
for (int i = 0; i <size; i++)
{
if (!(inFile>> customer[i] >>balance[i]))
}
break;
return i;
}
void sort(ifstream &inFile, float balance[], float size)
{
float temp = 0;
for(int j=1; j< size; j++)
{
for(int i=0; i< size-1; i++)
{
if(balance[i] > balance[i+1])
{
temp=balance[i];
balance[i]=balance[i+1];
balance[i+1]=temp;
}
}
}
}
void printResults(ofstream &outFile, ifstream &inFile, float customer[], float balance[], float size)
{
outFile << setprecision(2) << fixed << showpoint;
for (int i=0; i < size; i++)
outFile <<setw(10)<< customer[i]
<<setw(10)<< balance[i]
<<endl << endl;
}