Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I keep getting a declaration syntax error at line 34 (main) so I assume it is so

ID: 3694594 • Letter: I

Question

I keep getting a declaration syntax error at line 34 (main) so I assume it is somewhere in there, however I cannot figure out what is wrong. Also with the seekg conditional, can you suggest another way I could do it if you do not believe it will work? We are doing random access files in class. I can attach the other void methods if you would like.

#include <iostream.h>
#include <conio.h>
#include <math.h>
#include <iomanip.h>
#include <fstream.h>

struct StudentRecord
{
string lastName;
string firstName;
string SSN;
string Major;
string creditHours;
string GPA;
};

typedef StudentRecord Record[60];

int hash(string);
void print(Record[]);
void readNextRecord(Record[])

int main()
{
Record Students[60];
Record New[60];
fstream RandomFile;
ifstream DatFile;
int i,j;
char star = '*';

RandomFile.open("Random.dat", ios::in | ios::out);
DatFile.open("Program6.dat", ios::in);

for (i = 0; i <= 59; ++i)
{
RandomFile << "********* 00.00" << endl;
}


//creates dummy record file




while (!DatFile.eof())
{
if (RandomFile.seekg(i*58, ios::beg) == '*')
{
           readNextRecord(Students[i]);
           int j = hash(Students[i].SSN);
          
New[j] = readNextRecord(Students[i]);
++i;
}
       cout << j;

if( i > 59)
{
i = 0;
}
else
{
++i;
}
print(New[], RandomFile);
   return;
}

Explanation / Answer

use the following in your program:

RandomFile.open("Random.dat", ios::in | ios::out| std::fstream::app);