Hi there....
1stly sorry for the novice and beginner question but I really need help since I've been get fiddling to figure out the error but still have no idea whats wrong with it...here are's the code I'm using
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define MaxSize 100
#define MaxFound 30
class List{
int element;
int index;
int myList[MaxSize];
char __filename[50];
public:
List(char filename[50]){
strcpy(__filename,filename);
}
int readFile(){
element = 0;
index = -1;
FILE *datafile;
int i=0;
datafile = fopen(__filename,"r");
while((!feof(datafile))&&(i<MaxSize)){
fscanf(datafile,"%d",&myList[i].element);
myList[i].index = i;
i++;
}//end while
return i;
}
//%d --> integer
//%f -->float
//%s -->string
void displayList(int MySize){
int j;
cout<<"\n";
for(j=0;j<MySize;j++){
cout<<myList[j].element<<" "<<endl;;
}
}
}; //end clas
main(){
int fileSize;
List obj1("senarai.txt");
fileSize = obj1.readFile();
obj1.displayList(fileSize);
return 0;
}
So I really need help since I'm still beginner in C++ hoep someone can shed some light to me at least tell me whats wrong with this code....I'm also attach an image of the error that keep coming pop up to me.....same error...and I'm using borlandc++ 4.5