can u help me with these errors??and ye i realize its a little outdated but its jus he book im using i like it better than most and i cant find its updated version
#include <iostream.h>
#include <fstream.h>
struct jobInfo
{
short code;
long salary;
}
//function prototypes
void fillArray(ifstream, jobInfo employ[],short);
void searchAndDisplay(short, jobInfo[],short);
void main()
{
//declare and intilize varaible
short searchCode = 0;
//declare and initialize the array
jobInfo job[10] = {0,0};
//open file for input
ifstream infile;
infile.open("codes.dat",ios::in);
//verify that open was successful
if (!infile.fail())//open was successful
{
//fill arrays with data
fillArray(infile, Job, 10);
//close file
infile.close();
//get a code
cout<<"enter the code (0 to stop)\n";
cin>>searchCode;
cin.ignore(100,'\n');
while (searchCode != 0)
{
//search the array for the code and display the salary
searchAndDisplay(searchCode, job, 10);
//get another code
cout<<"enter the code (0 to stop)\n";
cin>>searchCode;
cin.ignore(100,'\n');
}//end while
}
else
cout<<"error opening file\n";
//end if
}//end main function
void fillArray(ifstream inEmp, jobInfo employ[],short size)
{
//this function fills the arrays with data from a file
for(short x = 0; x < size; x = x+ 1)
{
//enter data from a file into arrays
inEmp >>employ[x].code;
inEmp.ignore(1);
inEmp>>employ[x].salary;
inEmp.ignore(1);
}//end for
}//end of fillArray function
void searchAndDisplay(short inputCode,jobInfo employ[],short size)
{
/*this function searches for the code in the array
if the code is in the array, the salary is displayed
if the code is not in the array, a message is displayed*/
short x = 0;
char found = 'F';
while (x<size && found == 'F')
{
if(employ[x].code == inputCode)//code is in the array
{
cout<<"Salary: "<<employ[x].salary<<"\n\n";
found = 'T';
}
else
//add 1 to counter variable
x = x+ 1 ;
//end if
}//end while
if(found == 'F')//code is not in the array
cout<<"The salary is not the available.\n\n";
//end if
}//end of searchAndDisplay function
//end of code
--------------------Configuration: array - Win32 Debug--------------------
Compiling...
array.cpp
C:\Windows\Desktop\c++\array.cpp(9) : error C2628: 'jobInfo' followed by 'void' is illegal (did you forget a ';'?)
C:\Windows\Desktop\c++\array.cpp(25) : error C2065: 'Job' : undeclared identifier
C:\Windows\Desktop\c++\array.cpp(47) : error C2556: 'void __cdecl fillArray(class ifstream,struct jobInfo [],short)' : overloaded function differs only by return type from 'struct jobInfo __cdecl fillArray(class ifstream,struct jobInfo [],short)'
C:\Windows\Desktop\c++\array.cpp(9) : see declaration of 'fillArray'
C:\Windows\Desktop\c++\array.cpp(47) : error C2371: 'fillArray' : redefinition; different basic types
C:\Windows\Desktop\c++\array.cpp(9) : see declaration of 'fillArray'
Error executing cl.exe.
array.obj - 4 error(s), 0 warning(s)