#Need help in C (help with algorithm more than memory)

1 messages · Page 1 of 1 (latest)

topaz wasp
#

I can explain the problem even further

#

What I need help with is more with how I can make my else statement and print all the months

#

Here is an output

#

for summarize function for the source code I provided: my first if statement, the one with if (temp == ' ')

my argument gives me this output:

Command: summarize October
        October:    Total 3 Average Duration: 46.3333    Average Cost: 1.07

What I want is this for my else statement:

        January:    Total 2    Average Duration: 45.0000    Average Cost: 0.85
       February:    Total 2    Average Duration: 37.5000    Average Cost: 1.25
          March:    Total 1    Average Duration: 26.0000    Average Cost: 0.83
          April:    Total 0    Average Duration: 0        Average Cost: 0
            May:    Total 3    Average Duration: 44.3333    Average Cost: 0.73
           June:    Total 2    Average Duration: 22.0000    Average Cost: 0.81
           July:    Total 4    Average Duration: 47.5000    Average Cost: 1.20
         August:    Total 2    Average Duration: 44.5000    Average Cost: 1.37
      September:    Total 1    Average Duration: 68.0000    Average Cost: 1.96
        October:    Total 3    Average Duration: 46.3333    Average Cost: 1.07
       November:    Total 4    Average Duration: 35.2500    Average Cost: 1.56
       December:    Total 1    Average Duration: 26.0000    Average Cost: 0.71
#

As you can see

#

it does it all

#

I wrote a function that just does it for a specified month, and I dont know how to display all of them

floral crag
#

I'm so confused o-o'

#

have a list of all the months, each month being instences of a struct month with all the data and everything

#

then the "summarize all" would just iterate over the whole list

topaz wasp
#

I've done it

#

I just did array sort

#

and I iterated all of it