#Creating an Average from a file of data

15 messages · Page 1 of 1 (latest)

desert gyro
#

I'm not asking for the answer, just a nudge in the right direction. First time posting so I appreciate any help! I'm trying to create a for loop to find the average from a set of data after pulling that data from said file. There are 3 total scores for the exam and thought the initial exam would be listed as the first data point, 1, and go up to 3 as theirs 3 exams, but this isn't working. Again not asking for the answer, just really struggling and not sure where to turn.

ornate tulipBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

frozen axle
#

There's something wrong with this part of your code

for (int exam = 1; exam <= 3; number++)
{
    sum = sum + number;
    total = total + 1;
}
#

There are a couple of other parts that are wrong or I'm not sure what you're doing

desert gyro
#

Thanks for the input. To be honest, I'm completely lost. I don't know how to create a for loop to find the average of a set of data a in txt file. I'm trying my best to understand it but I have no clue what I'm doing. I don't understand fully how to create a for loop so I'm trying to read and learn on the go.

brisk hemlock
#

This will probably help you out a bit

#

learncpp is a great resource

desert gyro
#

Thank you for this! I really appreciate it!

frozen axle
#

after reading through it, if you have any questions we'll be glad to help

desert gyro
#

thank you again. I really appreciate the support

ornate tulipBOT
#

@desert gyro Has your question been resolved? If so, type !solved :)

frozen axle
#

when you say thanks the bot assumes your problem was solved

#

you don't have to do it yet

desert gyro
#

oh ok, good to know