Click here to Skip to main content
15,902,114 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: System Tray Context Menu Pin
Richard MacCutchan11-Mar-10 10:51
mveRichard MacCutchan11-Mar-10 10:51 
QuestionEncoding a string Pin
Herboren11-Mar-10 8:42
Herboren11-Mar-10 8:42 
AnswerRe: Encoding a string Pin
Chris Losinger11-Mar-10 8:48
professionalChris Losinger11-Mar-10 8:48 
AnswerRe: Encoding a string Pin
Jonathan Davies11-Mar-10 8:51
Jonathan Davies11-Mar-10 8:51 
GeneralRe: Encoding a string Pin
Herboren11-Mar-10 9:01
Herboren11-Mar-10 9:01 
GeneralRe: Encoding a string Pin
Jonathan Davies11-Mar-10 9:13
Jonathan Davies11-Mar-10 9:13 
GeneralRe: Encoding a string Pin
Herboren11-Mar-10 9:29
Herboren11-Mar-10 9:29 
GeneralRe: Encoding a string Pin
Herboren11-Mar-10 9:34
Herboren11-Mar-10 9:34 
Okay well i have another program that I just made and im still trying to figure out how this progam is getting the binary conversion:
// Binary Conversion.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <conio.h>
using namespace std;

void Show_Binary(unsigned int u);

int _tmain(int argc, _TCHAR* argv[])
{
	int i;
	cout << "Enter a number between 1 - 255: "; cin >> i;
	cout << "Your number in BINARY is      : "; Show_Binary(i);

	_getch();
	return 0;
}

void Show_Binary(unsigned int u)
{
	int t;
	for ( t = 128; t > 0; t = t / 2 )
		
		if (u & t) cout << "1 "; else
			
			cout << "0 ";

	cout << endl;
}


/*
u = 28

t = 128 t > 0 128 = 128 % 2

t = 64

if ( 128 & 28 ) = 0
if (  64 & 28 ) = 0
if (  32 & 28 ) = 0
if (  16 & 28 ) = 1
if (   8 & 28 ) = 1
if (   4 & 28 ) = 1
if (   2 & 28 ) = 0
if (   1 & 28 ) = 0



*/

as u can see I have been trying to figure it out myself in the comment below, but the 't = t / 2' is throwing me off, I understand the t = 128, using the binary scale: 128 64 32 16 8 4 2 1, but how its checking it, is whats confusing me, I understand the if statements but when if just sits there with the 'if ( u & t)' im asking myself "wtf is if asking, is it equal to, is it less than more than dammit 'if' tell me what your evil plot is!" lol
GeneralRe: Encoding a string Pin
loyal ginger11-Mar-10 9:39
loyal ginger11-Mar-10 9:39 
GeneralRe: Encoding a string [modified] Pin
Herboren11-Mar-10 9:44
Herboren11-Mar-10 9:44 
GeneralRe: Encoding a string Pin
loyal ginger11-Mar-10 9:36
loyal ginger11-Mar-10 9:36 
GeneralRe: Encoding a string Pin
Herboren11-Mar-10 9:39
Herboren11-Mar-10 9:39 
GeneralRe: Encoding a string Pin
Jonathan Davies11-Mar-10 9:40
Jonathan Davies11-Mar-10 9:40 
GeneralRe: Encoding a string Pin
Herboren11-Mar-10 9:50
Herboren11-Mar-10 9:50 
QuestionAny cryptography library in Visual C++? Pin
Jun Du11-Mar-10 5:28
Jun Du11-Mar-10 5:28 
AnswerRe: Any cryptography library in Visual C++? Pin
Chris Losinger11-Mar-10 5:43
professionalChris Losinger11-Mar-10 5:43 
GeneralRe: Any cryptography library in Visual C++? Pin
Richard MacCutchan11-Mar-10 5:51
mveRichard MacCutchan11-Mar-10 5:51 
AnswerRe: Any cryptography library in Visual C++? Pin
Keith Worden11-Mar-10 6:49
Keith Worden11-Mar-10 6:49 
QuestionMFC and DLL initialization - is this approach correct? Pin
Vaclav_11-Mar-10 4:31
Vaclav_11-Mar-10 4:31 
AnswerRe: MFC and DLL initialization - is this approach correct? [modified] Pin
Eugen Podsypalnikov11-Mar-10 4:56
Eugen Podsypalnikov11-Mar-10 4:56 
QuestionKill child process Pin
Pryabu10-Mar-10 23:13
Pryabu10-Mar-10 23:13 
AnswerRe: Kill child process Pin
Naveen10-Mar-10 23:15
Naveen10-Mar-10 23:15 
AnswerRe: Kill child process Pin
Eugen Podsypalnikov10-Mar-10 23:16
Eugen Podsypalnikov10-Mar-10 23:16 
AnswerRe: Kill child process Pin
Stephen Hewitt11-Mar-10 3:31
Stephen Hewitt11-Mar-10 3:31 
AnswerRe: Kill child process Pin
Stephen Hewitt11-Mar-10 4:59
Stephen Hewitt11-Mar-10 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.