hi guys, i dont know why when i run the code, its shows my txt is not found, here i attached the txt.file and the coding :)
i just follow the coding in the example that lecturer given, but yeah as i mentioned before, the txt cannot be found :( i hope u guys can help me
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
//Prototype
void readCards();
int main()
{
readCards();
return 0;
}
void readCards(){
const int CARDS = 10;
int ID[CARDS];
string cardName[CARDS] ;
string pcode[CARDS];
string type[CARDS];
string plusMode[CARDS];
string system[CARDS] ;
int i=0;
ifstream infile;
infile.open("cards.txt");
if (infile)
{
while (!infile.eof()){
//Read from file
infile >> ID[i] >> cardName[i] >> pcode[i] >> type[i] >> plusMode[i]>>system[i];
i++;
}
infile.close();
}
else
{
cout << "File cannot be found.\n";
exit(0);
}
}