Hello, what i'm supposed to do is open a file with some scores in it, and then:
1. Find the average
2. Find the minimum and maximum score
3. Display scores in rows of three.
What I have so far only lists the scores. Like so:
The scores are: 1
The scores are: 2
The scores are: 3
etc, until it lists all the scores. I want it to list them like so:
The scores are:
1 2 3
4 5 6
7 8 9
I want to know how to create 3 columns with an unknown number of rows.
One way you can think about printing the numbers is to continuously print them horizontally, without any line breaks. Then, keep track of how many numbers you have printed and for every third number, print a line break.
So at first, you would print the numbers as:
1 2 3 4 5 6 7 8 9 10 11 12 ...
Then add a counter and if the counter % 3 == 0, then output an endl:
Can you please, please, please show how to add the counter? Please, my teacher doesn't teach, and the book is not helping, and my teacher is not at school on Mondays, and it's due Tuesday, and I just want to cry because I have no idea of what I'm doing. Please help me.
I'm not the one to ask questions until I've tried a lot.
I'd believe that if you showed us your attempts because so far, I am sorry to say, with the suggestions you have been given by a couple of us, including the code, you just want someone to write your assignment for you.
For finding min and max, start by declaring a variable to store the value for each. You'll want to initialize each variable with an appropriate value.
As you read in each number from the file, compare that value with the value stored in the variable. If the new value is less than min, then update min to the new value. If the value is greater than max, then update max to the new value. That's it.