My program keeps getting me and error and i dont why
here is the error message
here is the code
here is the error message
- error C2061: syntax error: identifier 'infile'
- error C2660: 'ReadDate' : function does not take 6 arguments
- error C2086: 'char &junkChar' : redefinition
- see declaration of 'junkChar'
here is the code
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <cmath>
using namespace std;
void ReadDate(ifstream&, infile, int&, char&, int&, char&, int&);
int main()
{
ifstream infile("F:\\data2.txt");
int numberOfLines;
int month;
int day;
int year;
char junkChar;
infile >>numberOfLines;
for(int k =1; k<=numberOfLines; k++)
{
ReadDate(infile, month, junkChar, day, junkChar, year);
cout << month << junkChar<< day << junkChar << year << endl;
}
return 0;
}
void ReadDate(ifstream& infile, int&month, char& junkChar, int&day, char& junkChar, int&year)
{
infile >> month >> junkChar >> day >> junkChar >> year;
}
Comment