I'm trying to print out the contentes of my array in order to make sure I'm correctly filling up my array. How can I get the contents to display out on the console ? I have the following function reading numbers from a text file and if I have it set up correctly, they are being seeded into the array. How would I print them out in a main function ?
void donationReader(int d[])
{
int i =0;
int numberOfDonors = 0;
ifstream inFile; //Declare the input file stream
inFile.open("donations.txt"); //Opening the file
do{
inFile>>d[i];// seeding the numbers into the array :D
}while(!inFile.eof()); //Keep seeding the array with numbers until the end of the file.
if(!inFile){
cout << "Unable to open the file donations.txt";
exit(1); // shut dowm the program if possble
}
inFile.close();// Closes the file
}
I've tried to iterate with this bit of code but nothing prints on the screen.