# Search:

Type: Posts; User: R.Stiltskin

Page 1 of 20 1

1. ## Thread: (Help) A function that transforms a decimal number into binary

by R.Stiltskin
Replies
5
Views
885

### Take a close look at the end of line 9.

Take a close look at the end of line 9.

by R.Stiltskin
Replies
7
Views
1,551

### Seems wasteful to divide each number by 4,6,8 ...

Seems wasteful to divide each number by 4,6,8 ...

by R.Stiltskin
Replies
24
Views
1,611

Why do you think that static const double d = 2.0; isn't valid? d = 2.0 is a constant expression so it's allowed in the class definition.
[edit: forgot that this is a...

by R.Stiltskin
Replies
2
Views
725

### Think about what you're doing here: ...

Think about what you're doing here:

for(int i = 0; i < index; i++){
prevNode = newNode;
newNode = newNode->next;
}

Suppose for example that the index value is 10. How useful...

by R.Stiltskin
Replies
6
Views
743

### Do you have a question? You have a variable...

Do you have a question?

You have a variable called prevNode. So what is p for?
Where should prevNode point to start iterating through the list?

by R.Stiltskin
Replies
4
Views
720

### I think the operative words there were "Aren't...

I think the operative words there were "Aren't you supposed ..."

Start at the head of the list.

by R.Stiltskin
Replies
4
Views
720

### Aren't you supposed to find a position in the...

Aren't you supposed to find a position in the list that's passed into the function?
8. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### In the worst case, it's still O(n2). You would...

In the worst case, it's still O(n2).

You would do better to go back to your compact function in post #61 and make it in-place by simplifying it, rather than by complicating it. Essentially all...
9. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### Still working on this, I see. I was hoping that...

Still working on this, I see. I was hoping that by the time you finished implementing the step-counting you would have realized how simply (and efficiently) you could complete the assignment with...
10. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### Nice job. Now why don't you modify the program...

Nice job. Now why don't you modify the program so it counts (and prints) the number of assignments performed (i.e., how many times a number is moved from one place to another) while processing a...
11. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### We shouldn't turn this into a debate about...

We shouldn't turn this into a debate about complexity, but doesn't repeatedly shifting the entire array change it from O(n) to O(n2)?

But even ignoring the time complexity, it makes the program...
12. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### That's a viable approach and certainly worth...

That's a viable approach and certainly worth doing, if only for the benefit of the programming practice it gives you. However, think about how many operations the computer will be performing as...
13. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### Of course it's solvable. Think.

Of course it's solvable. Think.
14. ## Thread: Array Comparison and Modification

by R.Stiltskin
Replies
69
Views
3,903

### Are you sure you want to compare to element...

Are you sure you want to compare to element [i-1]?

PS: when you see entries like 2686632 popping up, you should suspect that you might be running out of the bounds of your array somewhere.

by R.Stiltskin
Replies
38
Views
2,798

### I'm sure your problem has nothing to do with the...

I'm sure your problem has nothing to do with the name-related code.

You must be using some archaic compiler. I can't even compile that code, and after I make the changes necessary to get it to...

by R.Stiltskin
Replies
38
Views
2,798

### edit: Good timing. I'll take a look at it.

edit: Good timing. I'll take a look at it.

by R.Stiltskin
Replies
38
Views
2,798

### Parameters are values that are passed from one...

Parameters are values that are passed from one function to another. In the case of the char* pointer, the value that's being passed is the address of a char variable. This variable (in this case...

by R.Stiltskin
Replies
38
Views
2,798

### Instead of declaring user in that function, pass...

Instead of declaring user in that function, pass user as a parameter to the function. It's also a good idea to pass the size of the array as another parameter, and use fgets instead of gets to...
19. ## Thread: OpenCV and Visual Studio 2010: Infamous namespace error.

by R.Stiltskin
Replies
5
Views
18,789

### I don't have a Windows machine handy to test...

I don't have a Windows machine handy to test with, but where did you ever read any mention of a "namespace cv"? And where did you find "cv.hpp"?

Try

#include <cv.h>
#include <cxcore.h>...
20. ## Thread: Basic char */const char* problem

by R.Stiltskin
Replies
7
Views
1,542

### It's hard to tell what your problem is from the...

It's hard to tell what your problem is from the little code you posted, but maybe this will help:

include <iostream>
#include <string>
using namespace std;

class A {
21. ## Thread: C fwrite with JPEG Data

by R.Stiltskin
Replies
11
Views
3,426

### The usual way in C is to use sprintf...

The usual way in C is to use sprintf which works basically the same as printf except it writes to a string instead of to the console.
22. ## Thread: C fwrite with JPEG Data

by R.Stiltskin
Replies
11
Views
3,426

### You're treating your jpeg data as if it were a...

You're treating your jpeg data as if it were a string -- but it's not. A string is a null-terminated char array. When you use strlen(data) to pass the size of the array to fwrite, you are measuring...
23. ## Thread: Have an error that i can't solve

by R.Stiltskin
Replies
5
Views
1,056

### #pragma once does basically the same thing as...

#pragma once does basically the same thing as include guards, except that it is non-standard, i.e. is only supported by specific compilers.
24. ## Thread: need help with Card Dealing Program

by R.Stiltskin
Replies
5
Views
1,118

### Or if you insist: wDeck[i].color = i/26; ...

Or if you insist:

wDeck[i].color = i/26;

will give 0 when i is less than 26 (hearts & diamonds) and 1 otherwise.
25. ## Thread: need help with Card Dealing Program

by R.Stiltskin
Replies
5
Views
1,118