I was using the FillPolygon function to draw opaque polygons. I didn't know about the FromArgb function, that is what I was looking for.
Thank you both!
Type: Posts; User: Sfel
I was using the FillPolygon function to draw opaque polygons. I didn't know about the FromArgb function, that is what I was looking for.
Thank you both!
Hello,
Suppose I have two Point / PointF arrays P1 and P2. How can I draw two polygons on a panel, one from P1 and the other from P2, such that the two are transparent? Meaning, in case they...
The easiest way is to just add INT_MAX + 1 to all the numbers, thus making them positive and maintaining their relative order. Then just do if [x / y] = 0 => return y. Otherwise or if y = 0 return x....
True. My method only works if all the numbers have the same sign.
However, it is easy to check the sign bit and act accordingly: if all the numbers are either positive or negative, my method does...
if the numbers are non-zero integers we can do this:
first, convert all the numbers to unsigned integers. This will get us rid of negative numbers.
then, if floor(x / y) = 0, x < y
then just...
Why would that give me 0% security? Outside of fopen(), as far as I can understand what nm does, I can just have a list of "what's allowed to show up in nm", which is all the C/C++ standard functions...
So basically, my best chances are:
1. run nm on the resulting executable and check for anything suspicious. Assuming I have an exhaustive list, how safe is this? if I remove all the windows.h etc...
I see, that should be easy enough to do then. I have a few more questions however.
Can I compile the source on the host machine, send it to the virtual machine and run it there? Can I do some...
Wouldn't:
#include <stdio.h>
unsigned int DeleteFileA(const char *aFile);
int main()
{
printf("x = %d\n", DeleteFileA("c:\\boot.ini");
return 0;
Hello,
I am working on a program that will be compiling user-sent C/C++ source code and running the resulting executable on a server. The source code is expected to solve an exact task, but...
This would only get you the length of the path. But you can build the path by using the values in the distance matrix: we could only have gotten on one value from an adjacent value that is lower than...
Consider the following example, where 1 means inaccessible cell and 0 means accessible:
* 0 0 0 0
0 1 1 1 1
0 0 0 0 0
1 1 1 1 0
1 1 1 1 *
You want to get from one "*" to the other.
You can use breadth-first search, but if you apply it directly on your given matrix, it will be O(XY). If you're given an adjacency list, then it'll be O(V+E).
Consider a queue where you first...
I'm not really a big fan of them either, I just thought this was a simple problem and it would be fun to try to squeeze into this limit. Doesn't serve any real purpose but...
Also, it's a shame...
EVOEx: ~180 characters is really nice, guess that makes your solution the best so far :). Good job.
IceDane: I know the PE problem, but there was no size restriction there. I think the problem is...
Yes. For example:
7
1 4
5 2 3
You would select 7 + 4 + 5 = 16, but this is invalid.
The correct paths are: 7 1 5, 7 1 2, 7 4 2, 7 4 3, with the max being 7 + 4 + 3 = 14
To find out if your...
I'll try.
You're given a triangle of numbers, let's take the second example:
1
1 2
4 1 2
2 3 1 1
You start from the first element of the first row (1). You can go to the element below it...
I recently stumbled across this problem: https://www.spoj.pl/problems/SUMITR/ and had a fun-yet-frustrating time solving it in C/C++ on the gcc compiler. I got my code to 253 bytes when all...
For those who are interested in the method, I used the sieve of eratosthenes in the following way:
1. Figure out a maximum range (hi) such that the interval [lo = 2^31 + 1, hi] contains at least...
Here's mine. I hope I didn't break any rules; according to the first post I should have only one function, and I have 2 (+main). If it needs any modifications to be accepted let me know.
Runs in...
That works! Thanks.
Hello,
I'm using C++ Builder and trying to run a program with CreateProcess. For example:
if ( !CreateProcess("cmd", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) )
MessageBox(NULL,...
Write my own simple server (a list of connected IPs and just basic text sending/receiving) and my own client... nothing fancy.
Yes, I know about the winsock library. I meant something that makes things easier, like what indy does in C Builder.
Those links are very useful however, thanks.
Hello,
I would like to get into windows socket programming, and I was wondering if anyone knows any good, free socket libraries that makes handling communications easier. I'm only interested in...