Search:

Type: Posts; User: Brad0407

Page 1 of 14 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    8
    Views
    1,057

    I'm not sure what your goal is with num_data. ...

    I'm not sure what your goal is with num_data. You're on the right track with the % operator, but for loops are designed for... looping. I believe you want something more like:


    if(even_test)
    {...
  2. Replies
    7
    Views
    960

    I doubt that you want to initialize the pointer...

    I doubt that you want to initialize the pointer in the while loop. That will destroy your tree every iteration. And by initialize the pointer, I assume you mean:


    T = NULL;
  3. Replies
    7
    Views
    960

    Like Salem said "freeing something that wasn't...

    Like Salem said "freeing something that wasn't allocated to begin with" will cause a seg fault which is the case here.

    You are using makeEmpty before T is initialized. When using pointers, you...
  4. Replies
    23
    Views
    2,366

    The classical solution to this problem:...

    The classical solution to this problem: Dijkstra's algorithm. A* would also work, but without a good heuristic, it wouldn't be much of an improvement.
  5. You program works for me. I copied the code...

    You program works for me. I copied the code above and all I changed was %f's in scanf to %lf's and FILE *inp, outp; to FILE *in, *outp;
    nvm
  6. Replies
    4
    Views
    11,165

    If you're making a temp copy of the new file...

    If you're making a temp copy of the new file anyways, why not just close the file and reopen it for writing "w". That will erase everything.
  7. Thread: Whats wrong

    by Brad0407
    Replies
    13
    Views
    1,754

    >> What's wrong You didn't use tags and you...

    >> What's wrong
    You didn't use
    tags and you posted C code in the C++ forum. You also didn't tell us anything about:
    1. What input you're giving the code
    2. What output you expect
    3. What...
  8. Replies
    4
    Views
    1,246

    Tokenize isn't a standard C++ function. I got if...

    Tokenize isn't a standard C++ function. I got if off this website.
    You can also check the FAQ for more detail on tokenizing.
  9. Replies
    4
    Views
    1,246

    I don't think you can do what you want with...

    I don't think you can do what you want with getline, but you can read in the whole line and then use OneString.find_first_of (if you want them one at a time) or Tokenize (to get all the strings at...
  10. Replies
    8
    Views
    1,212

    If there are more than 2 lines and you only want...

    If there are more than 2 lines and you only want the first 2 of them, you're going to have to do one of the ways that Daved suggested. Here's the way I would use:

    // open infile

    // for each of...
  11. Replies
    8
    Views
    1,212

    I think you should take (count < 3) out of the...

    I think you should take (count < 3) out of the while loop.
  12. Replies
    9
    Views
    1,155

    void delayMessage(){ char delay; ...

    void delayMessage(){
    char delay;

    printf("\n Please press enter to return to the main menu\n");

    scanf("&#37;c",&delay);
    }
    You have to pass a the address of delay to...
  13. Replies
    27
    Views
    6,297

    Yea, I'm struggling with words today. I was...

    Yea, I'm struggling with words today. I was thinking of unicode when I wrote that. Thanks for clarifying.
  14. Thread: Advanced AI

    by Brad0407
    Replies
    36
    Views
    8,755

    Calm down there, buddy. I see your point. There...

    Calm down there, buddy. I see your point. There are 2 main objections that I have but I can see where you're coming from. It's not a big deal anyways.
  15. Replies
    27
    Views
    6,297

    It's for portability. Sometimes characters are 1...

    It's for portability. Sometimes characters are 1 bytes. Sometimes they are 2 bytes for extended characters like chinese characters. In the future, it may be even more. So toupper takes an int to...
  16. Thread: Advanced AI

    by Brad0407
    Replies
    36
    Views
    8,755

    To abachler: I think everyone agrees that AI has...

    To abachler:
    I think everyone agrees that AI has no free will and some people think that humans don't have free will (hard determinism). What are you arguing? I'm sorry, your post just seems off...
  17. Replies
    50
    Views
    5,198

    Every experienced programmer on this forum and...

    Every experienced programmer on this forum and many programmers that are still learning. I didn't bother to count.
  18. Thread: Idiot guide

    by Brad0407
    Replies
    20
    Views
    2,554

    That is not the output I get. Are you sure it...

    That is not the output I get. Are you sure it isn't this:

    int i = 9;
    for (i--; i--; i--)
    printf("%d", i);
  19. Replies
    18
    Views
    9,995

    If you code overflows, it made a number that was...

    If you code overflows, it made a number that was too big for it to store in whatever datatype you were trying to store the number in. It's possible that you're doing "ridiculously high calculations"...
  20. Replies
    9
    Views
    1,739

    char InBuff[8] = "12345678"; "12345678" is a...

    char InBuff[8] = "12345678";
    "12345678" is a string literal. It's actually 9 characters long "12345678" <- your string + '\0' null terminator. So basically you have an array bounds overflow. It...
  21. Replies
    19
    Views
    2,428

    This code would need to be in the constructor and...

    This code would need to be in the constructor and you would need to pass the filename to it.

    ifstream file("dictionary.txt");
    if(!file)
    {
    cout <<"\nError! The file couldn't be opened\n";
    }...
  22. Replies
    4
    Views
    994

    typedef is used to define an alias for a type. I...

    typedef is used to define an alias for a type. I think typedef stands for typedefinition.
    If I wrote this statement:

    typedef char letter;
    letter my_letter = 'a';
    printf("my_letter = &#37;c\n",...
  23. Replies
    6
    Views
    1,280

    void box(length, width, height) length, width,...

    void box(length, width, height)
    length, width, and height are variables and you need to specify types for them. In the prototype these variables all have type "int":

    void box(int length, int...
  24. Replies
    3
    Views
    1,404

    This is all I could find...

    This is all I could find
  25. Replies
    3
    Views
    1,404

    3 Problems with that: 1. That's a big example....

    3 Problems with that:
    1. That's a big example.
    2. Not very specific. I don't know what the invoices are supposed to look like, what's being purchased, what the shop's logo looks like, etc...
    3....
Results 1 to 25 of 343
Page 1 of 14 1 2 3 4