Like Tree2Likes

Need help creating linked list of vectors

This is a discussion on Need help creating linked list of vectors within the C++ Programming forums, part of the General Programming Boards category; Thanks laserlight, maven and everyone else for their suggestions. My program is working like a charm now....

  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
    Posts
    23,012
    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
    2,917
    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

Page 2 of 2 FirstFirst 12
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, 11:34 AM
  3. Creating a Sorted Linked List, Help Please!
    By larry_2k4 in forum C Programming
    Replies: 4
    Last Post: 04-28-2009, 02:12 AM
  4. Is this creating a linked list?
    By JFonseka in forum C Programming
    Replies: 6
    Last Post: 10-24-2007, 02:33 AM
  5. Creating Linked list in .NET
    By axp in forum Windows Programming
    Replies: 1
    Last Post: 05-15-2004, 01:41 AM

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