Thread: Need help creating linked list of vectors

  1. #16
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Thanks laserlight, maven and everyone else for their suggestions. My program is working like a charm now.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    andrewmills, don't use casts. Especially not when you don't know when to use them.
    And when you are a beginner, don't use C-style casts. They can do more than you know (as you've just found out).
    If you are writing good C++ code, then chances that you need casts are slim. Avoid them. Then you know you aren't doing some terrible mistake the compiler is telling you to avoid.
    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.

  3. #18
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Quote Originally Posted by Elysia View Post
    andrewmills, don't use casts. Especially not when you don't know when to use them.
    And when you are a beginner, don't use C-style casts. They can do more than you know (as you've just found out).
    If you are writing good C++ code, then chances that you need casts are slim. Avoid them. Then you know you aren't doing some terrible mistake the compiler is telling you to avoid.
    Elysia, thanks for your suggestion. I will definitely keep that in min from now on.

  4. #19
    Registered User
    Join Date
    Jul 2012
    Posts
    11
    Hi forum. I have another question regarding this program. Now, as a a part of the program, I am supposed to calculate the maximum and minimum value of "seismic size", " air temperature" and "ground temperature". One way to do this, whic I know how to do, is calculating maximum and minimum values for each quantity separately. However, that is going to make the code awfully long. So, I was wondering if there is another short and more efficient way of doing this. My idea is to creat a function that lays out the fundamental way of calculating the maximum and minimum value and maybe we could transfer other functions -GetSeismicSize(), GetAirTemp, GetGroundTemp- as parameters into this function and thus, calculate maximum and minimum value of each quantity. But, again it is just my idea. If this is to happen, we should be able to create a function with another function as a parameter. And, I am not sure if it possible to do this or not.

  5. #20
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Yes, it is possible to create a function that has a function pointer as a parameter. You may also want to look into Functors. Here is another page about function pointers and functors that may be of some help.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating Doubly Linked List Help!!
    By newbiecprogram in forum C Programming
    Replies: 3
    Last Post: 11-29-2010, 12:00 PM
  2. i have a problen in creating a linked list
    By transgalactic2 in forum C Programming
    Replies: 2
    Last Post: 07-02-2009, 10:34 AM
  3. Creating a Sorted Linked List, Help Please!
    By larry_2k4 in forum C Programming
    Replies: 4
    Last Post: 04-28-2009, 01:12 AM
  4. Is this creating a linked list?
    By JFonseka in forum C Programming
    Replies: 6
    Last Post: 10-24-2007, 01:33 AM
  5. Creating Linked list in .NET
    By axp in forum Windows Programming
    Replies: 1
    Last Post: 05-15-2004, 12:41 AM