daily average

This is a discussion on daily average within the C Programming forums, part of the General Programming Boards category; Also, I dont need to fix anything, my code works, dont try and sound above me just because you want ...

  1. #16
    Registered User
    Join Date
    Dec 2005
    Posts
    8
    Also, I dont need to fix anything, my code works, dont try and sound above me just because you want to be a jerk. You didnt help at all, its not my fault you couldnt figure out what I was asking. I explained it pretty clearly, you just wanted to make me feel stupid. I obviously knew how to add up 24 numbers and divide by 24, all I was asking for was how to make it happen at midnight, while displaying a running average. If your so smart you should have seen my question right away and just answered that instead of asking me questions I had already answered.

  2. #17
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    Well, that's what you get when you don't post the code you have, the OS you have, the compiler you have.

    Phrases like "This is to be written in C code" just look like attempts from lazy people to get others to do their homework.

  3. #18
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Dude, you don't even know what you were asking. Do you really want me to do this? Alright, here goes:
    Quote Originally Posted by pamd
    Hello, I am trying to find out how to write a program which will take the average over the day. I dont want it to just take the average over the last 24 hours, I know how to do that, rather I want to find the average from 12 midnight to 12 midnight the next day, and to have this average displayed throughout the day and changing as the day progresses. This is to be written in C code
    Here we go. In this first post you say you:

    1 - Want to find out how to [...] take the average over the day.

    This implies that you want to average today's data. You don't say, "Hey, I want to input a given day, find all of that day's data, and average it." No, you say you want to take the average over the day. This implies taking everything so far for today and averaging it.

    2 - You don't want the last 24 hours.
    3 - You want the average from 12 midnight to 12 midnight the next day.

    Ok, here's where you hit a big problem. You're either saying:
    a - Get yesterday's full 24 hours of data, which was 12 midnight yesterday, until the 12 midnight at the start of today, and average that. Except you just said you didn't want that. Nice contradiction there.

    b - You want to start at today's midnight, and go "into the future, Conan?" No? Think I'm just being silly? Let's try that again: "rather I want to find the average from 12 midnight to 12 midnight the next day". Sorry Bunny, you can't take an average of something that hasn't happened yet.

    c - You want to start at midnight of today, up to the current time, and average that.

    So Salem goes on to tell you to sum up 1 ... 24. But somehow, you still can't understand this simple concept:
    Quote Originally Posted by pamd
    But how do I make sure it starts at 12 and ends at 12, i dont want it to just start wheneverr the program starts
    I'm still trying to figure out how this is hard.
    Quote Originally Posted by quzah
    Average from what? Where are you getting whatever it is you're averaging? And why on earth is this hard to figure out? Pick a point, stop 24 iterations later.

    Quzah.
    Yep, that sounds like it fits the bill for every single possiblity you wanted in your first post. Oh, except for that whole "time travel thing". Somehow you took that as rude. I guess because you're thin skinned. Or just stupid. (See, that was ... no, that wasn't rude either. That was just not nice.)
    Quote Originally Posted by pamd
    I am measureing the voltage coming from a solarimeter. I am having difficulties because I want it to start over at midnight no matter what time I start the program. If I was to just average over 24 hourly samples as you rudely suggested, then it would depend on the time I started running the program for when it would stop averaging. I stated I do not just want it over a random 24 hour period in my original post, I know how to do that.
    Here, you're confused by the concept of a clock, I guess, because while you state that you know how to ... [get] it over a random 24 hour period ... You still can't figure out that whole wacky "midnight of DOOM" thing. Why in the hell, if you supposedly can pick any random starting point, and go from there, can't you figure out how to start at MIDNIGHT? What's so damn confusing about MIDNIGHT? So ........ing start a counter at zero, sub... .wait a second! I already told you how to do this:
    Quote Originally Posted by quzah
    So again, why is this hard?

    1 - Get the current time.
    2 - Average from midnight to now.
    3 - Wonder why this is hard.
    But yeah, that still wasn't good enough for you.
    Quote Originally Posted by pamd
    Thanks for those who actually helped and tried to understand what I was asking, noone actually gave me information I used,
    I honestly am amazed at how stupid people are. Seriously. Look at a freeking clock. Now, count backwards to midnight. How hard was that? Oh, right. You're probably one of those people who only knows how to tell time on a digital clock. That whole "big hand" / "little hand" thing is too much for you.

    Look at this, look at how hard this is:
    Code:
    if( not past noon )
       now == hours from midnight
    else
        12 + now == hours from midnight
    HOLY CRAP! That's INSANE! No, wait, maybe you have a 24 hour clock, so this is still too much for you. Ok, one last time, since I'm such a nice guy.
    Code:
    now = hours from midnight
    It's MADNESS! MADNESS I TELL YOU!

    Grab the "hours from midnight" elements, sum them, divide by "hours from midnight". There you go. You've just started over at midnight. You know, that whole "way too hard for you" thing?


    “Look at that. Arafat. Me with Arafat. Bunny we used to
    call him. What a tool! Yeah, they were some days man, when I was
    with the company. You’re not interested in any of this?”


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #19
    Registered User
    Join Date
    Dec 2005
    Posts
    8

    To dungeons and dragons loser!

    If you could even comprehend the question we were asking than you'd have half a clue you're probably sitting in your moms basement right now face covered in acne dreaming about the time you got to see Xena's boob on on of those internet loner chat sites effing cobra commander wannabe.....

    PamD

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C program using structs to calculate grades
    By TampaTrinDM88 in forum C Programming
    Replies: 4
    Last Post: 07-06-2009, 12:33 PM
  2. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  3. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  4. Average score
    By wiz23 in forum C++ Programming
    Replies: 22
    Last Post: 05-05-2005, 05:38 AM
  5. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21