on line 32 how would i go about inputting a file name to be called by my function which im using a const char pointer for the file name
line 33) error C2664: 'calculationOutput' : cannot convert parameter 1 from 'char' to 'const char *'
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;
void calculationOutput(const char* inputFile);//,const char* outputFile);
ifstream inFile;
ofstream outFile;
const int records = 10;
const int month = 12;
int monthArray[records][month];
int averagedArea[month];
int sum[month];
int summedMonths[month];
int averaged[month];
string monthN;
char inputFile;
int main()
{
for(int count=0; count!=2; count++)
{
cout << "enter the input files name: ";
cin >> inputFile;
calculationOutput(inputFile);
}
return 0;
}
void calculationOutput(const char* inputFile)//, const char* outputFile)
{
//opens and test for exsistence of data files
inFile.open(inputFile);
if(! inFile)
{
cout << "No such input/output file exsists";
}
//declaration of variables sensitive to calculations
int highestMonthTemp=0;
int highestAreaTemp=0;
int highestMonth=0;
int highestArea=0;
int extra=0;
int numRecords=0;
//pulls in data and counts number of records
for(int i=0; i<records && inFile; i++)
{
for(int j=0; j<month; j++)
{
int hold=0;
inFile >> hold;
if(!inFile) break;
monthArray[i][j] = hold;
}
if(inFile)
{
numRecords++;
}
if(i>records)
{
extra++;
}
}
//Averages the areas
for(int i=0; i<numRecords; i++)
{
for(int j=0; j<month; j++)
{
sum[i] = monthArray[i][j]+sum[i];
}
averagedArea[i] = sum[i]/month;
}
//compares to find the highest area and the temperature
for(int i=0; i<numRecords; i++)
{
if(averagedArea[i]>averagedArea[highestArea])
{
highestArea=i;
highestAreaTemp=averagedArea[i];
}
}
//calculates the totals for the months and stores them
for(int i=0; i<month; i++)
{
for(int j=0; j<numRecords; j++)
{
summedMonths[i]=summedMonths[i]+monthArray[i][j];
}
}
//calculates the averages and stores that
for(int i=0; i<month; i++)
{
averaged[i]=summedMonths[i]/numRecords;
}
//finds the month with the highest temperature and stores the temp
for(int i=0; i<month; i++)
{
if(averaged[i]>averaged[highestMonth])
{
highestMonth=i;
highestMonthTemp=averaged[i];
}
}
if(highestMonth == 0)
monthN = "January";
if(highestMonth == 1)
monthN = "February";
if(highestMonth == 2)
monthN = "March";
if(highestMonth == 3)
monthN = "April";
if(highestMonth == 4)
monthN = "May";
if(highestMonth == 5)
monthN = "June";
if(highestMonth == 6)
monthN = "July";
if(highestMonth == 7)
monthN = "August";
if(highestMonth == 8)
monthN = "September";
if(highestMonth == 9)
monthN = "October";
if(highestMonth == 10)
monthN = "November";
if(highestMonth == 11)
monthN = "Decemeber";
//output
for(int i=0; i<numRecords; i++)
{
cout << i << " " << sum[i] << endl;
}
cout << "The area with the highest average temperature is #" << highestArea << " with a temperature of " << highestAreaTemp <<endl;
cout << monthN << " had the highest average temperature of " << highestMonthTemp <<endl;
cout << "The number of data records that were read in and not used were: " << extra << endl << endl;
}