Our teacher wants us to take an array and output it via these instructions. The array conists of grades (ie 92 72 83...etc):

"Write the output to a text file. In it, display the original grade array, 10 per line, in fields of 5."

My question is, what does that mean? I get the 10 per line part but whats "fields of 5"? This program is due today and I cant get in touch w/ my teacher so maybe you might now what that is.

Thanks in advance!

Pure speculation, but maybe 10 grades per line, 5 lines per field, and each field separated by a blank line:

x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x

x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x

...

Hmm that would make sense. However just wondering since something I just realized also is that there are no more than 50 grades so there would never need to be more than 5 lines?

How would I begin to sort these? Is it via setw?

Sorry again being new at this makes things really frustrating.

I don't know. Two guesses. One, five characters per column:

87   54   32   12   13  100    3   12  100    2

Each column takes up five spaces, total of 50 spaces per line. Second guess. Group 5 rows together:

87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2

   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2

   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2
   87   54   32   12   13  100    3   12  100    2

Obviously the numbers would be different for each row. Anyway, like I said, just wild guesses.

Hmm that would make sense. However just wondering since something I just realized also is that there are no more than 50 grades so there would never need to be more than 5 lines?

How would I begin to sort these? Is it via setw?

Sorry again being new at this makes things really frustrating.

Sorting and spacing are separate problems. setw could help you with the spacing part if you, for example, go with my guess # 1.
http://www.cplusplus.com/reference/iostream/manipulators/setw.html

For sorting, you have to sort the ten scores and display them in order or something? Or all of them? There are a lot of sorts out there.
http://en.wikipedia.org/wiki/Sorting_algorithm

Bubble sort isn't the most efficient in the world, but is easy to code:
http://en.wikipedia.org/wiki/Bubble_sort

Or go with a pre-written C++ sort:
http://www.cplusplus.com/reference/algorithm/sort.html

Thanks for the help everyone. I went with guess #1 so hopefully that was it! I look forward to being on this forum more often! :)

This question has already been answered. Start a new discussion instead.