Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help to modify a program so that it will work with a datafile \"scores2.d

ID: 3534414 • Letter: I

Question

I need help to modify a program so that it will work with a datafile "scores2.dat" that has less than 1000 numbers(grades). You'll use the technique of partially filled arrays. Output the number of values read in addition to another datafile called "scores.dat". Do not count manually and hard code your program for that many values.

#include <iostream>

using namespace std;

#include <fstream>

int main()

{

           ifstream fin; //file stream variable

           int num;

          

           fin.open("../datafile.dat);

           if (!fin)

           {

                       cout << "Error opening file. ";

                       return 1;

           }

          cout << "Numbers ";

          while (fin >> num)

          {

                      cout << num << endl; //output num read

                      // this is where you would put the code to store num in your array

                      // thsi is where you would put a counter to count the items read too

           }

           fin.close();

           return 0;

}

Explanation / Answer

//not sure what your last sentence meant, but this reads in scores2.dat: http://ideone.com/uUcaMY

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote