|
SilverShalkin wrote:
~%: I kind of now know It denotes the modulus of a number over a base
e.g Number % base
it is defined as the remainder of Number / base. Hence x % 20 will return numbers from 0 through 19, as Christian said.
e.g.
1%20 = 1
2%20 = 2
19%20 = 19
20%20 = 0
21%20 = 1
etc.
|
|
|
|
|
SilverShalkin wrote:
~Truth Table: The truth table works with binary right? it usualy looks like:
&& 0 1
0 0 0
1 0 1
I dont get how to read this table... or what it exactly does...
This looks like it is just trying to show you what a bitwise and does (&&)
&&| 0 1
0 | 0 0
1 | 0 1
This is a matrix of what happens when two values are anded together. So to get 0 && 0 you would read down from 0 in the top row, until you get to the row that has 0 in the left hand column.
Make sense?
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
SilverShalkin wrote:
~Clear Screen: What is the simplist way to clear the DOS screan?
Type "cls" at the DOS prompt. Sorry, I'm being a smart ass. I don't know the real answer to that one.
SilverShalkin wrote:
~ASCII code: Such as 'a' = #"some number" how do you figuer out what each letter code is? And how does it help you in the future?
Go to http://www.asciitable.com and look up the letters in the table. Keep in mind that the numbers shown are probably in hexadecimal format.
SilverShalkin wrote:
~Truth Table: The truth table works with binary right? it usualy looks like:
&& 0 1
0 0 0
1 0 1
I dont get how to read this table... or what it exactly does...
Well, as an example, here is the truth table for a logical AND of some a and b (arbitrary choice of variable names):
a b | AND
---------
0 0 | 0
0 1 | 0
1 0 | 0
1 1 | 1
This means that "a AND b" as a logical expression is only true when both a and b are 1. If either a or b (or both) are 0, then "a AND b" is false.
Boolean algebra is a whole field of study by itself. I'm sure there are better explanations online. Just search for truth tables, and you're bound to find something.
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Jon Sagara wrote:
Well, as an example, here is the truth table for a logical AND of some a and b (arbitrary choice of variable names):
Ah... It's immediately obvious when the thing is formatted properly.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Jon Sagara wrote:
Type "cls" at the DOS prompt. Sorry, I'm being a smart ass. I don't know the real answer to that one.
I tried that it worked in QBasic though .
Yes i know... The forum is still little weirded to me. That little scrunched up 0's and 1's was suppose to be a truth table.
Jon Sagara wrote:
a b | AND
---------
0 0 | 0
0 1 | 0
1 0 | 0
1 1 | 1
so in this example, on the far left:
0
0
1
1
is suppose to represent 'a'?
and if this opens up a hole new form of reserch, what is it used for?
also... how do you know what a is = to? "its not common sense is it "
Thanks for your response's
~SilverShalkin
Firm Grip of Darkness
Darkness surounds my hollow heart
Deep trembling shaketh my hurting soul
Why must it be like this?
The weight is pulling me down
it's cold touch, as icy fingers
It plunders my last breath of air
It taketh me away
In darkness
I fall
Dustin Tigner
|
|
|
|
|
It's simple - if a = 0 (false) and b = 0 (false) a&b = 0; 0&1 = 0, 1&0=0, 1&1=1. Both statements need to be true for the statement to evaluate to true. An XOR would look like this:
a b XOR
0 0 0
1 0 1
0 1 1
1 1 0
Get the idea ?
SilverShalkin wrote:
and if this opens up a hole new form of reserch, what is it used for?
To be honest, I think it's a longwinded way of illustrating something pretty obvious.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
SilverShalkin wrote:
so in this example, on the far left:
0
0
1
1
is suppose to represent 'a'?
Yes, but 'a' was an arbitrary assignment. You could just as easily replace 'a' and 'b' with 'M1' and 'M2', or 'Jon' and 'Sagara.' Variable names make it easier to perform Boolean algebra.
SilverShalkin wrote:
and if this opens up a hole new form of reserch, what is it used for?
Boolean logic forms the basis of the computer industry - 1s and 0s, on and off, high voltage and low voltage, TRUE and FALSE. I highly suggest you read tutorials on it and become very familiar with the binary, octal, decimal (a given), and hexadecimal number systems, and how to convert between them.
Boolean logic is used all the time in code: if() statements, while() statements, bit shifting, ... It's very important stuff.
SilverShalkin wrote:
how do you know what a is = to?
Like I said, 'a' was an arbitrary assignment to a table column. Just move down the rows of the column:
State 0: a = 0, b = 0
State 1: a = 0, b = 1
State 2: a = 1, b = 0
State 3: a = 1, b = 1
No, this wasn't common sense stuff for me, I had to study it to pick it up. Maybe some of the CPians with a mathematical background can provide a better explanation and/or point you to some online resources. Feel free to keep asking questions, though. I'll keep answering and try not to confuse you too much.
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Jon Sagara wrote:
Boolean logic forms the basis of the computer industry - 1s and 0s, on and off, high voltage and low voltage, TRUE and FALSE. I highly suggest you read tutorials on it and become very familiar with the binary, octal, decimal (a given), and hexadecimal number systems, and how to convert between them.
Boolean logic is used all the time in code: if() statements, while() statements, bit shifting, ... It's very important stuff.
well if you say:
Jon Sagara wrote:
It's very important stuff.
I guess ill study it , Any tutorials in mind, or just look around?
This thread will be good for only a bit more, "Than people stop responding " I'll give a look into it and post a thread sometime in the future with my new questions
If any one else can help out with these questions, that would be great.
Thanks guys
~SilverShalkin
My poetic toung can only speak its
ryhm for so long, i shall return
|
|
|
|
|
I learned Boolean algebra from Modern Digital Design in a digital design course. However, that book is old. The newer version of that books is Digital Design Essentials, which is quite an excellent text. The author provides many worked examples, which are pure gold to students like me. They only downside to these books are the prices: $100+
If I were you, I would scour the web. There are bound to be tutorials out there.
Jon Sagara
What about ?
Best Miniputt score: 21
Sonork ID: 100.9999 jonsagara
|
|
|
|
|
Howdy all!
Does anyone know a nice way to threshold the contents of a DC (i.e. set all pixels below a certain threshold to black)? I have a feeling that judicious use of BitBlt() with the right Raster Options should do it, but I can't get my head around all that AND, OR, XOR etc wrt bitmaps.
Anyone have any pointer?
TIA,
Pete
|
|
|
|
|
I can't think of a way that this would work, I'd do it manually with a DIBSection.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
My bitmap is already greyscale, so that's not a problem.
I've already got a routine that thresholds on a per-pixel basis, I was just hoping there was a quicker way to do it.
Ah well.
|
|
|
|
|
Hi.
I have a rectangle of size:
CRect recTmp = CRect(0, 0, 200, 200);
In OnSize() message handler, I'd like to center text and other items inside the rectangle based on the new sizeof the window.
So, if the user resizes the window to CSize newSize(250, 250), the text and items new position will be (125, 125).
Anyways, I need a way to get the most current size of the view rectangle in either CPoint or CSize.
I have tried GetWindowOrg() and GetWindowExt(). I have not gotten any accurate size back from CDC.
Thanks,
Kuphryn
|
|
|
|
|
The new size is passed into OnSize() ; you can also use GetClientRect() .
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
Nice!
I kept searching for help and looking all functions starting with "Get." I do not remember seeing GetClientRect().
Thanks.
Kuphryn
|
|
|
|
|
I want to "connect" two strings together. Like MFC's CMapStringToString, just both ways, and I'm not using MFC. There should be no limit to how many strings that can be stored. Btw, I've made my own little string-class, so only need a method for mapping them together. I also want the method to be fast, so iteration through a huge list of strings is not something I want to do.
Anyone got an elegant solution...?
Sprudling
|
|
|
|
|
Use a single list or array to store all the strings. Be sure each entry is unique. Then use one map to map the indices/pointers to each other in whatever combinations are appropriate.
This should be pretty fast, since the strings are only stored once, and string comparisons need only be made when new strings are added to the list.
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
It would not be fast at all if it was a list.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
why is this?
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
Because you'd have indices into a container to look up the actual strings, and list lookups require walking the list, they are slow compared to arrays which have instant lookup.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
!
Yes that would be slow. For a list i think you'd want to go with pointers.
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
You could also look at the STL's pair<>.
|
|
|
|
|
You'll need a containter for strings and two maps - one for each 'way'. STL classes will be OK for that.
Aggregate these objects into one class, provide an interface - that's all.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I am using Chris' DIBSection wrapper for Win32 and WinCE. It is a great class, it's easy to use and very powerful.
But when I am using it, I have a question:
At first, I opened a 256-grey-scale bitmap file, using
m_pdib->Load("mybitmap.bmp");
Then in OnDraw(CDC *pDC)
{
m_pdib->Draw(pDC, pt, TRUE);
CPen redPen;
VERIFY(redPen.CreatePen(PS_SOLID, 1, RGB(255,0,0)));
CPen *pOldPen = pDC->SelectObject(&redPen);
pDC->Ellipse(pt.x, pt.y, pt.x+10, pt.y+10);
pDC->SelectObject(pOldPen);
}
The problem is: the bitmap file will be displayed correctly, but the red circle will not be displayed. I tried to use a white pen, but the circle couldn't be drawn either.
What did I do wrong?
Thank you very much for your help!
|
|
|
|
|
Are you sure values in pt are good ? Have you tried a hard coded constant to check ? Maybe pt is in screen co-ordinates, and needs ScreenToClient called on it ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|