Search:

Type: Posts; User: whiteflags

Page 1 of 20 1 2 3 4

Search: Search took 0.05 seconds.

  1. Replies
    3
    Views
    453

    So the idea of this is fine, I guess. > char...

    So the idea of this is fine, I guess.

    > char key[100];
    Here you declare key as an array and it's empty.

    > k = 'A' + (c - key);
    Then you start using the array name of the key to decrypt...
  2. Replies
    7
    Views
    427

    The program will need to convert the text "53"...

    The program will need to convert the text "53" and other bytes written out like "6a" into numbers. When you have the numbers in number format, then you can use them as characters.

    It's a simple...
  3. Replies
    7
    Views
    427

    That sounds more correct. What matters with files...

    That sounds more correct. What matters with files is how you open them. There are different functions that make reading text files easier, like fgetc, that you know, and there are different functions...
  4. Replies
    7
    Views
    427

    Are you trying to read a text file with fread?...

    Are you trying to read a text file with fread? That's what it sounds like and it's not exactly the most practical thing. For one thing, if fread succeeds, you would still need to turn '5' (the...
  5. Replies
    9
    Views
    694

    As a technical note, if you shift left normally...

    As a technical note, if you shift left normally the leftmost bits will be discarded. If you somehow shift these bits back into the lower end, that describes a rotation.

    The method you have seen...
  6. Replies
    4
    Views
    957

    I think you're on the verge of turning your...

    I think you're on the verge of turning your tokenizer into a parser. It does not need to be more complicated than separating tokens from white space. Separating tokens like "j=+3" or "j+3" into parts...
  7. Replies
    3
    Views
    695

    While this works, the p1 object has global scope,...

    While this works, the p1 object has global scope, which is probably overkill. You wouldn't need personPtr at all.

    If the point of the exercise was to use pointers, it makes more sense to write...
  8. It is not enough to just print the numbers that...

    It is not enough to just print the numbers that are the largest and smallest. The computer is not going to remember which variable it is, so you need to also assign the largest number to a, and the...
  9. Replies
    13
    Views
    1,247

    I'm pretty sure you wrote hatvany() wrong. alap...

    I'm pretty sure you wrote hatvany() wrong. alap *= alap; doesn't really help much.

    You want to do, for example:
    res = 1;
    alap = 2;
    exp = 3;
    res *= alap;
    --exp;
    res *= alap;
    --exp;
  10. Replies
    12
    Views
    2,479

    Well, these questions are for mind readers. What...

    Well, these questions are for mind readers. What did you press? What was the four digit number you cast into?

    Here's another fact about unbuffered input. Every single keypress matters. In a way,...
  11. Well, encryption is a rather big topic and using...

    Well, encryption is a rather big topic and using it in a secure way can be hard. I'm going to assume that whatever you want to hide is fairly nonserious and you just want to protect a file from...
  12. Consider encryption. It might be a pain...

    Consider encryption.

    It might be a pain because you have to learn an encryption algorithm, and your program has to decrypt the file (in RAM) before using the contents, but the contents are at...
  13. Replies
    8
    Views
    851

    You might want to read your IDE documentation in...

    You might want to read your IDE documentation in case your setup uses a default makefile and target.

    The way that make works is "make -f <makefile> <target>" when specifying a file and target, or...
  14. Replies
    35
    Views
    2,664

    Bear with me but I don't think these cases are...

    Bear with me but I don't think these cases are very realistic. 4/5 are about cheating in gaming, which I think you know is wrong and you can be caught all the time and lose the ability to play. Steam...
  15. Replies
    6
    Views
    3,420

    OK well, by choosing to declare the array outside...

    OK well, by choosing to declare the array outside of main or any other function you are implicitly saying it has a static storage duration. This can mean a few things, but in this case it means that...
  16. Replies
    35
    Views
    2,664

    It might be instructive to read the wikipedia...

    It might be instructive to read the wikipedia page on decompilers. There are numerous challenges to doing it with any sort of positive outcome. The code that will be spit out is not a thoughtfully...
  17. Replies
    8
    Views
    863

    I think part of the problem is you repeated the...

    I think part of the problem is you repeated the material type a lot. There are two switches handling the same thing.

    It would be way easier to understand if there were one switch handling that...
  18. Replies
    8
    Views
    863

    The program doesn't even have to be that fancy,...

    The program doesn't even have to be that fancy, you can use simple techniques and get it done, just start and ask a more concrete question.

    You've done your exams, and even if you passed them with...
  19. Thread: Homework

    by whiteflags
    Replies
    14
    Views
    1,230

    Correct me if I'm wrong, but it looks like you...

    Correct me if I'm wrong, but it looks like you are compiling for the macintosh. You can fix the error with sleep(1); by including the Mac header for it: #include <unistd.h>. More here.

    Review how...
  20. I've also never heard of this. However, the math...

    I've also never heard of this. However, the math is based on using a scale factor. If you can figure out a suitable base-ten scale factor for your input, then you can do the math in integers with all...
  21. That wouldn't be what I would do, personally. I...

    That wouldn't be what I would do, personally. I would pass i and j into the function and calculate i*x+j internally. This way, you can think of board the way you are using it, even though it is just...
  22. I think you should be able to copy the 2D array...

    I think you should be able to copy the 2D array algorithm whole cloth if you just convert the i, j coordinates to a one dimensional subscript.

    It's a simple formula i * x + j where x is the total...
  23. My bad. Your analysis is correct, however. I...

    My bad. Your analysis is correct, however.


    I got the idea from laserlight, who posted a loop going in reverse.

    Laserlight's loop uses subscripts and goes in reverse, my loop uses iterators...
  24. Iterators aren't numbers, they don't need to be...

    Iterators aren't numbers, they don't need to be unsigned.

    For example if I wanted this to use iterators, I might write:

    for (auto it = terms.rbegin(); *it != terms.rend(); ++it)
    The type for...
  25. No, declaring variables at the bottom of the...

    No, declaring variables at the bottom of the script is not useful and is confusing at best.

    There are a couple of things going on here. First, C++ is executed in roughly top down order, so you...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4