Thread: Now I need help adding arrays

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by master5001 View Post
    ...though I suppose mine tend to sound a little sarcast or underwhelming.
    They typically do, and usually I gather them when specific conditions are reached and well... what can I say? Typically, you do not fulfill those requirements or conditions.
    Not to worry, though. There is so much space in the signature anyway. I do not lose appreciation for you.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well thanks, Elysia. I have to admit I think those spots should be more reserved for those who did stare at their code for the past six hours only to have your remedy their bug in mere seconds. So don't worry, I don't take it hard.

  3. #18
    Registered User
    Join Date
    Oct 2008
    Posts
    18
    haha, I understand Arrays now. But problems are still occurring. I'll try to fix it on my own though. Thanks for the help master5001 for the previous post.

  4. #19
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Yi, out of idle curiosity, what was the exact terms of the wager? Is there money involved, or humiliation?

  5. #20
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by Elysia View Post
    Indeed you are and the tutorial explains it very well how arrays work.
    You have the array, and you have the size of the array.
    If you were given a bunt of papers in real life, and the number of papers, and on each of those papers is a number. Take those numbers and add them up. How would you do that in real world?
    Type it in pseudo code first.
    This is technically a rather poor example since an array is not required for a solution. You could run through the values one at a time and determine the sum. But if you wanted to do something else with those same values such as determine the mean, then an array as a data structure helps. Arrays allow you to retrieve the same data more than once in an efficient way, as any data structure must.

  6. #21
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Just to to mention that "bunt" is not an English word (or at least, it doesn't mean what I'm 99% sure you meant by it). The correct english word is perhaps "pile", "stack" or "ream" (a "ream" is often used for a specific number of sheets, usually 500).

    Really, an array is a collection of just about any type of things.

    Wikipedia defines arrays in MANY words. http://en.wikipedia.org/wiki/Array

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #22
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Quote Originally Posted by citizen View Post
    This is technically a rather poor example since an array is not required for a solution. You could run through the values one at a time and determine the sum. But if you wanted to do something else with those same values such as determine the mean, then an array as a data structure helps. Arrays allow you to retrieve the same data more than once in an efficient way, as any data structure must.
    Quote Originally Posted by matsp View Post
    Just to to mention that "bunt" is not an English word (or at least, it doesn't mean what I'm 99% sure you meant by it). The correct english word is perhaps "pile", "stack" or "ream" (a "ream" is often used for a specific number of sheets, usually 500).

    Really, an array is a collection of just about any type of things.

    Wikipedia defines arrays in MANY words. http://en.wikipedia.org/wiki/Array

    --
    Mats
    ^ Pundants of an explanation that produced:

    Quote Originally Posted by nifear4 View Post
    haha, I understand Arrays now. But problems are still occurring. I'll try to fix it on my own though. Thanks for the help master5001 for the previous post.
    I am sorry, but no matter how you perceive the explanation, I think it was adequate enough to get the point across. There is no need to argue the semantics of the explanation. The OP was happy and a little wiser. Plus someone is going to win a bet. So what more can be asked for?

  8. #23
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Well instead of asking for humility I chose pedantry out of self-satisfaction.

  9. #24
    Registered User
    Join Date
    Oct 2008
    Posts
    18
    to answer your questions master5001. He knows that I get motivated by having a bet or a competition. And he wants me to really go after my goals. Haha, we are like brothers in a sense. So thats why he made the bet, there really isn't anything involved except that the only thing that I get is more knowledge. but I've working on the program since 9pm last night until now and I still seem not to get it right. Lol. but thanks guys for helping me and trying to help me. I'm just total newb at life. lol

  10. #25
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Well, if you show the code, we can give you a million advice about what is wrong and what needs fixing, etc.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #26
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Hahah! Thats how I get the ladies.... being a newb at life. Fair enough to you both. Especially citizen for taking the moral high road.

    Can I challenge you through frivelous bets too? I bet you can't explain how this function works, Yi. And notice I am addressing a single person and not everyone on the forum?

    Example:
    Code:
    #include <math.h>
    #include <float.h>
    
    #ifndef M_PI
    #  define M_PI (3.14159265358979323846) 
    #endif
    
    #ifndef M_2PI
    # define M_2PI (6.28318530717958647692)
    #endif
    
    struct trig_table
    {
      double sin, cos, tan, csc, sec, cot;
    };
    
    struct trig_table *create(int ndegrees)
    {
      double nrads = (double)ndegrees * M_PI / 180.0, count;
      int ticks = (int)floor((M_2PI / nrads) + 0.5), i;
      struct trig_table *table = malloc(sizeof(*table) * ticks);
    
      if(!table)
        return 0;
    
      for(i = 0, count = 0.0; i < ticks; ++i, count += nrads)
      {
        table[i].sin = sin(count);
        table[i].cos = cos(count);
        table[i].tan = tan(count);
        table[i].csc = (table[i].sin)? 1.0 / table[i].sin : NAN;
        table[i].sec = (table[i].cos)? 1.0 / table[i].cos : NAN;
        table[i].cot = (table[i].tan != NAN) ? ((table[i].tan)? 1.0 / table[i].tan : NAN) : 0.0;
      }
    
      return table;
    }
    Yi, what does that function do? And does it usefully demonstrate the use of arrays? Or was it a waste of time. Explain either answer.

  12. #27
    Registered User
    Join Date
    Oct 2008
    Posts
    18
    Well, I just got back from finishing the program thanks to Cmaster 5001, but no thanks to the girl. Whoever she is, "thats not a goddess" (Quoted: By my CS Professor). But yeah, I'll run through your program cmaster, since I admire you more than my own professor. But Elysia gets me confused... maybe its just me, or maybe because humans can't understand what the ........ a false goddess says. But thats just me.

  13. #28
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Quote Originally Posted by nifear4 View Post
    Well, I just got back from finishing the program thanks to Cmaster 5001, but no thanks to the girl. Whoever she is, "thats not a goddess" (Quoted: By my CS Professor). But yeah, I'll run through your program cmaster, since I admire you more than my own professor. But Elysia gets me confused... maybe its just me, or maybe because humans can't understand what the ........ a false goddess says. But thats just me.
    There is neither need to put down Elysia's contributions nor a need to use language that is censored out. I am probably not any more knowledgeable than "the girl," for the record. I probably (and maybe not even) just have more real world experience. Be nice to senior members, even if your CS Professor isn't. You did come here for help, afterall. And I appreciate your kind comments, but you need not be insulting to others here. Its not like any of us get paid to help you... Ok I admit... a lot of us are technically getting paid to help you since we view the forums while at work, but you know what I mean.

  14. #29
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by nifear4 View Post
    Well, I just got back from finishing the program thanks to Cmaster 5001, but no thanks to the girl.
    And imagine what you would have been able to learn if you had just tried.
    I tried to put you on the right path. I may be a little harsh in what I expect from people, but it does them well in the end.
    They become better programmers.
    Oh and thank you very much for that little "no thanks" part. Very nice of you.

    Whoever she is, "thats not a goddess" (Quoted: By my CS Professor).
    And who was it that quoted that, hm?
    And for the record, I am merely a programmer, not more, not less. I am neither superior nor inferior to other programmers out there.
    I do not consider myself a "goddess." If you see it anywhere, it is not to be taken seriously.

    But Elysia gets me confused... maybe its just me, or maybe because humans can't understand what the ........ a false goddess says. But thats just me.
    Why, thank you. You are so kind.
    Yes, that is just you. I have helped countless others, along with other members, and they have indeed thanked me for it (you did too, remember?).
    But there is one thing to say you do not understand and not thing to be right out rude. If you are going to be rude, then you can take a one-way ticket out of here. Do not expect to be able to get away from real life etiquette here.
    If you do not understand what someone tries to tell you, simply state so, and you will likely get help from a different view from the same member or some other members fills in to teach you. But if you are rude, then no one will want to help you.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding numbers with arrays
    By Oliveira in forum C Programming
    Replies: 4
    Last Post: 04-16-2009, 10:25 PM
  2. Adding arrays with pointers - help
    By chip.litch in forum C Programming
    Replies: 2
    Last Post: 10-02-2008, 11:07 PM
  3. SVN Import Causes Crash
    By Tonto in forum Tech Board
    Replies: 6
    Last Post: 11-01-2006, 03:44 PM
  4. Adding character arrays to strings.
    By w00tw00tkab00t in forum C++ Programming
    Replies: 28
    Last Post: 02-06-2006, 07:03 PM
  5. Adding multidimensional arrays
    By newbie2C++ in forum C++ Programming
    Replies: 3
    Last Post: 11-13-2001, 04:05 PM