# Search:

Type: Posts; User: whiteflags

Page 1 of 20 1

1. ## Thread: bitwise char array shift

by whiteflags
Replies
9
Views
196

### 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...
2. ## Thread: Parse trees for dummies?

by whiteflags
Replies
4
Views
245

### 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...

by whiteflags
Replies
3
Views
141

### 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...
4. ## Thread: I want to plus largest number and smallest number

by whiteflags
Replies
4
Views
135

### 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...
5. ## Thread: FOR cycle problem

by whiteflags
Replies
13
Views
807

### 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;
6. ## Thread: Is there anything like _getch()?

by whiteflags
Replies
12
Views
921

### 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,...
7. ## Thread: Using a file format to save information that the user can't readily access?

by whiteflags
Replies
14
Views
779

### 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...
8. ## Thread: Using a file format to save information that the user can't readily access?

by whiteflags
Replies
14
Views
779

### 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...
9. ## Thread: Well-done, but can't compile

by whiteflags
Replies
8
Views
660

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...

by whiteflags
Replies
35
Views
2,236

### 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...
11. ## Thread: initializer element is not constant

by whiteflags
Replies
6
Views
1,272

### 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...

by whiteflags
Replies
35
Views
2,236

### 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...
13. ## Thread: HELP in homework

by whiteflags
Replies
8
Views
627

### 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...
14. ## Thread: HELP in homework

by whiteflags
Replies
8
Views
627

### 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...

by whiteflags
Replies
14
Views
765

### 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...
16. ## Thread: Finding common values in the rows of a vector [Need Help]

by whiteflags
Replies
17
Views
761

### 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...

by whiteflags
Replies
3
Views
486

### 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...

by whiteflags
Replies
3
Views
486

### 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...
19. ## Thread: Expression: vector subscript out of range [Debug Assertion Fail]

by whiteflags
Replies
11
Views
1,501

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...
20. ## Thread: Expression: vector subscript out of range [Debug Assertion Fail]

by whiteflags
Replies
11
Views
1,501

### 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...
21. ## Thread: Declaring variables below the script rather than at the beginning?

by whiteflags
Replies
6
Views
502

### 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...
22. ## Thread: Is this a valid way to do a copy instead of a memcpy?

by whiteflags
Replies
5
Views
348

### I think what's important here is that there is no...

I think what's important here is that there is no way the commented memcpy() will do something that assignment won't.

If the type can't be assigned, that will be a problem, but it's one that I...

by whiteflags
Replies
2
Views
517

### The middle table always starts at 55, even if you...

The middle table always starts at 55, even if you change the parameters of print_abc_reverse(). When you look at the loop for that table, one sees why that is:

for(rev=55;rev<=to; rev++)...
24. ## Thread: Storing data in an arbitrarily large data type on the stack

by whiteflags
Replies
17
Views
1,425

### The only reason a union was suggested was because...

The only reason a union was suggested was because you specifically said earlier, "I want to be able to store it anywhere on the stack instead of using malloc or dynamic allocation on the heap (don't...
25. ## Thread: sequential number program

by whiteflags
Replies
2
Views
673

### Make him an offer based on what you can afford...

Make him an offer based on what you can afford and see if he agrees. Software pricing is so divorced from simply paying for development time and other costs. Most things you buy are either priced low...
Results 1 to 25 of 498
Page 1 of 20 1