Personal Program that is making me go wtf?

This is a discussion on Personal Program that is making me go wtf? within the C Programming forums, part of the General Programming Boards category; I know I'm going off-topic but using dumb and long algorithms like the ones you use only make it easier ...

  1. #16
    Registered User
    Join Date
    May 2006
    Posts
    903
    I know I'm going off-topic but using dumb and long algorithms like the ones you use only make it easier for you to commit mistakes. Besides, I really think you don't understand the concept of arrays, pointers and loops. You could have your ID variable be an array and store all the values... yet that would be completely useless... Why don't you use teams[print].player_array[i] ? Here's what you could do if you really don't want to type teams[print].player_array[i] ...
    Code:
    PlayerInfo* p = teams[print].player_array;
    for(int i = 0; i < teams[print].noPlayers; i++)
        printf("Player %d: %d\n", i, *(p + i));
    Coding the way you are right now, you will never be able to code any program larger than basic console programs. When you get to write OpenGL game, will you hard-code every single pixel instead of using the right tools ? Do you realize I have just written in 3 lines what you coded in over 30 lines ? You're writing 10 times too much code.

  2. #17
    Registered User
    Join Date
    Jun 2006
    Posts
    14
    I know that my code is long. I get that. I don't spend all my time doing this. I am doing this in my spare time. I do not wish to become a programmer. I said that I was going to go back over it once I have it working to shorten it...its just something I am doing to relax. :|

  3. #18
    Registered User
    Join Date
    May 2006
    Posts
    903
    I'm doing this for fun as well.

  4. #19
    Registered User
    Join Date
    Jun 2006
    Posts
    14
    Ok, the only thing that is not working with the code you suggested was initial and surname search....its not liking them

  5. #20
    Registered User
    Join Date
    Jun 2006
    Posts
    14
    I've got the initial search to work, but it doesn't like the surname. It wont let me do this:

    players[print].familyName[0];

    I can do: players[print].familyName
    and say, print the entire surname, but it wont look at just one character

  6. #21
    Registered User
    Join Date
    Jun 2006
    Posts
    14
    Its ok, I forgot to use strncmp

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

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 02:42 AM
  2. Help on making program run more efficiently
    By peeweearies in forum C Programming
    Replies: 2
    Last Post: 03-23-2009, 03:01 AM
  3. Making a program take a variable number of arguments
    By subtled in forum C Programming
    Replies: 1
    Last Post: 04-17-2007, 06:38 AM
  4. Making interest rate program in C
    By canadas321 in forum C Programming
    Replies: 6
    Last Post: 06-23-2005, 12:59 PM

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