Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.11 seconds; generated 10 minute(s) ago.

  1. Replies
    3
    Views
    116

    Chuck the various constants into a few (static)...

    Chuck the various constants into a few (static) arrays. Then instead of huge if-else chains, you just select the constant by accessing the relevant array by index, after which you can call...
  2. Replies
    4
    Views
    130

    Instead of returning a multiple, you could print...

    Instead of returning a multiple, you could print it in the loop body.

    You might also consider if skipping numbers by the multiple might be a more efficient approach.
  3. You are mistaken:

    You are mistaken:
  4. I suggest reading Eric Raymond's article on The...

    I suggest reading Eric Raymond's article on The Lost Art of Structure Packing. The section on "Structure alignment and padding" has a similiar example with explanation why there might be trailing...
  5. Replies
    2
    Views
    151

    Just in case, let's clarify: you passed -O3...

    Just in case, let's clarify: you passed -O3 rather than -o3 as an option, right?
  6. Replies
    11
    Views
    540

    I'm not sure what to make of this: either you...

    I'm not sure what to make of this: either you know your cryptography and are just trolling (with a second account), or you don't know your cryptography and so have no clue as to why "considering...
  7. Replies
    11
    Views
    540

    The term "autokey cipher" refers to a particular...

    The term "autokey cipher" refers to a particular kind of encryption algorithm.


    A quick glance shows that you have implemented a kind of substitution cipher of the "XOR cipher" variety, although...
  8. You're looking at declarations of a pointer to a...

    You're looking at declarations of a pointer to a pointer, of an array of pointers, and of a pointer to an array, respectively.

    As for how to dynamically allocate memory for them: first, you need...
  9. By using another parameter to determine which...

    By using another parameter to determine which functionality to invoke. But that's irrelevant until you have implemented them, so don't ask me for an example until you show us your implementation of...
  10. Looking at your past posts, you mentioned trying...

    Looking at your past posts, you mentioned trying to implement an autokey cipher. Going by the Wikipedia article, this involves the use of a "primer" that is prepended to the plaintext to generate the...
  11. That's a good attempt, but instead of using...

    That's a good attempt, but instead of using new[], you should use a std::vector. For example:

    #include <iostream>
    #include <vector>

    using namespace std;

    class Planet {
    public:
    ...
  12. Replies
    1
    Views
    202

    Yes, but you probably want && instead of bitwise &

    Yes, but you probably want && instead of bitwise &
  13. These warnings are telling you that you passed a...

    These warnings are telling you that you passed a string literal as an argument where the parameter is a char* rather than const char*. The reason why this is a red flag is that what a char* parameter...
  14. Replies
    5
    Views
    243

    At a glance, one issue is that you are not...

    At a glance, one issue is that you are not resetting intTotal to 0.

    Since all these tasks are separate, it would be best if you wrote a self-contained function for each of them.

    By the way,...
  15. Please do your own homework. You're free to come...

    Please do your own homework. You're free to come here to ask questions if you're stuck, but not to cheat by getting other people to do your homework for you.
  16. Replies
    10
    Views
    385

    Salem already shared the "secret" with you in the...

    Salem already shared the "secret" with you in the previous post:

    (Of course, where appropriate you can replace fgets with another function that reads a line, e.g., POSIX getline)
  17. Replies
    1
    Views
    171

    You're sorting strings, so it would be most (or...

    You're sorting strings, so it would be most (or least) significant character or byte rather than bit.
  18. That error doesn't make sense in C since...

    That error doesn't make sense in C since bucket_entry and bucket are typedefs for struct types, and hence object types, and there is always a valid conversion from void* to a pointer to object type....
  19. Trace through the loop with some example input,...

    Trace through the loop with some example input, e.g. 'e'. How many iterations does the loop loop over?

    By the way, you need to indent your code properly. This is especially helpful when you're...
  20. Delete the return 0; in count_digits

    Delete the return 0; in count_digits
  21. Thread: Lists.

    by laserlight
    Replies
    4
    Views
    184

    Since you have to ask, obviously, no, you can't....

    Since you have to ask, obviously, no, you can't.

    But I can :)

    The thing is, when you are faced with a problem like this, you need to break it down into smaller problems that you can solve....
  22. Thread: Lists.

    by laserlight
    Replies
    4
    Views
    184

    Yes, of course: just traverse the circular linked...

    Yes, of course: just traverse the circular linked list counting node by node until you have, um, gone full circle :)
  23. Whether char is signed or unsigned is...

    Whether char is signed or unsigned is implementation defined, and it looks like it is signed in this case, hence 255 is converted to -1. I would change to use unsigned char instead of char since that...
  24. Replies
    15
    Views
    934

    What help do you need?

    What help do you need?
  25. Replies
    15
    Views
    934

    To make this easier to understand: Indent the...

    To make this easier to understand:

    Indent the code consistently. Right now there's some indentation, but it is rather inconsistent, so it is not as helpful as it could be.
    Get rid of the global...
Results 1 to 25 of 495
Page 1 of 20 1 2 3 4