Search:

Type: Posts; User: Dr. Bebop

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    3,594

    Hammer: I'll be sure to change it if you can...

    Hammer:
    I'll be sure to change it if you can suggest a way to deal with the problems that would be safer than just trusting the user to not be stupid and call free_mem in the right order. ;)
    ...
  2. Replies
    8
    Views
    1,569

    Cool, is the source available somewhere so I can...

    Cool, is the source available somewhere so I can see how you did things?
  3. Replies
    9
    Views
    1,183

    You wouldn't get 3, rand()%3 gives you a range...

    You wouldn't get 3, rand()%3 gives you a range between 0 and 2 but not including 3, add one to that and you get the range 1 to 3.
  4. Replies
    8
    Views
    7,724

    int quest; char int_holder[10]; printf("Are...

    int quest;
    char int_holder[10];

    printf("Are you sure you wish to exit the Menu?\n");
    printf("Press 1) to return to Options or 2) to exit the Menu: ");
    quest = atoi( fgets( int_holder, 10, stdin...
  5. Replies
    7
    Views
    3,594

    Enmeduranki: I'd expect that you wouldn't get...

    Enmeduranki:
    I'd expect that you wouldn't get what you wanted, explained below.

    moi:
    I thought about it, but picked the one I thought would be easier to write without terrible bugs.

    Hammer:...
  6. Replies
    8
    Views
    1,569

    That's pretty fun, did you write it?

    That's pretty fun, did you write it?
  7. That's like saying "If you walked past a...

    That's like saying "If you walked past a homosexul person one day how would you feel?". It's pointless. You should ask what you mean instead of dancing around it, "Do homosexual people make you...
  8. Replies
    7
    Views
    3,594

    Memory handler

    Okay, here's a custom memory handler I wrote for strings so that I won't have to make a bunch of calls to malloc. I probably won't use it, but it's good practice and might come in handy sometime. The...
  9. Replies
    12
    Views
    1,284

    We feel there should be no teachers because...

    We feel there should be no teachers because teachers are usually the ones who know jack and can't get a real job programming, so they teach. There're exceptions, just like everything, but judging...
  10. Replies
    26
    Views
    2,725

    If you're going to use goto, at least jump...

    If you're going to use goto, at least jump forward in the code instead of backward. If you jump backward it makes the program harder to follow.
  11. Replies
    7
    Views
    4,487

    Same as above, ifyou're writing pure C then use...

    Same as above, ifyou're writing pure C then use malloc/free, if you're writing C++ then use new/delete.
  12. Replies
    25
    Views
    4,939

    I do. :p Even for 1 line programs I still want it...

    I do. :p Even for 1 line programs I still want it to be right, if using a big sophisticated(sp.) text editor helps me do that then I'll use it. It's better to take the time to be right than to suffer...
  13. Replies
    2
    Views
    1,173

    Read usenet's comp.lang.c++...

    Read usenet's comp.lang.c++ and alt.comp.lang.learn.c-c++. Those are the best places to get good information on C++, everywhere else you're not sure about the quality.
  14. Replies
    25
    Views
    4,939

    That's kind of dumb. Why use something like...

    That's kind of dumb. Why use something like notepad when you can get much better text editors for free? You lose a lot of productivity when you have to do everything by hand that good editors do for...
  15. Replies
    12
    Views
    1,284

    From what I've seen all of the learn online...

    From what I've seen all of the learn online classes suck. Just get a bunch of good books on the subject and have at it. That's how I learned.
  16. Replies
    7
    Views
    4,487

    The overhead is barely noticeable with a...

    The overhead is barely noticeable with a profiler, much less in a running program. Allocating memory takes time no matter how it works, so use malloc/free with C and new/delete with C++.
  17. Replies
    6
    Views
    2,693

    *(ptr + i) and ptr[i] are both the same, but...

    *(ptr + i)
    and
    ptr[i]

    are both the same, but scanf takes a pointer, so if you used the array indexing you would have to use &ptr[i] and if you used pointer notation, which is stupid since array...
  18. Thread: string class

    by Dr. Bebop
    Replies
    2
    Views
    1,188

    I don't think this should work anyway, data()...

    I don't think this should work anyway, data() returns an array with each character in the string an element in the array but the last element isn't a null character. c_str() returns the same as...
  19. Replies
    3
    Views
    1,338

    Converting binary to decimal is easy if the...

    Converting binary to decimal is easy if the binary number is a string. Just do something like this.


    #include <stdio.h>
    #include <string.h>

    void revstr( char *str )
    {
    char...
  20. Replies
    25
    Views
    4,939

    What's so hard about copy/paste and then using...

    What's so hard about copy/paste and then using your compiler's hot key for formatting? In VC++ 6.0 just select the code you want to format and hit ALT+F8 and this


    #include <iostream>
    #include...
  21. Replies
    39
    Views
    6,811

    I get server errors most of the time and it's...

    I get server errors most of the time and it's slow whenever I don't get errors.
  22. Replies
    11
    Views
    1,810

    The big time problem was in this line. *at++...

    The big time problem was in this line.


    *at++ = *(at + 1);

    It's undefined behavior because it changes at more than once in the same expression. It worked fine for me too, but that doesn't mean...
  23. Replies
    11
    Views
    1,810

    Ignore the first two functions I gave you,...

    Ignore the first two functions I gave you, they're both big time wrong. This one's right.


    void remchr( char *string, const char item )
    {
    char *at;

    while( (at = strchr(...
  24. Replies
    11
    Views
    1,810

    Here's another that removes all occurances of the...

    Here's another that removes all occurances of the item instead of just the first one. :)


    void remove_char( char *string, const char item )
    {
    char *at;

    while( (at =...
  25. Replies
    11
    Views
    1,810

    Pretty easy. #include #include...

    Pretty easy.


    #include <stdio.h>
    #include <string.h>

    void remove_char( char *string, const char item )
    {
    char *at = strchr( string, item );
Results 1 to 25 of 96
Page 1 of 4 1 2 3 4