Question: I am having problems with reading a file into an array. This is my code. This is what I get when I run my program.
I am having problems with reading a file into an array.
This is my code.


This is what I get when I run my program.

But this is my text file I am reading.

I tried everything and it seems to be reading in the last digit of the file. I want to read in their names line by line into an array and ultimatly also read in the scores line by line.
1 E/7 Programming Assignment 6.cpp Defines the entry point for the console application. 2 #include #include #include #include "stdafx.h" "string" "iostream"' "fstream" 6 7 8 9 10 using namespace std; //read and store data into two arrays 12 Ebool GetBowlingData(string fileName, string nameArray[]) fstream myfile; 14 15 16 17 18 19 20 21 : myfile.open(fileName); ?: if (!myfile . fail()) : //loop until the last line of the file : : while (!myfile . eof()) 1//populate the arrays from the fil 23 24 25 26 27 28 29 30 int n 0; myfile nameArray[n :return true; return false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
