www.delorie.com/archives/browse.cgi | search |
From: | "Traveler" <traveler AT netti DOT fi> |
Newsgroups: | comp.lang.c++,comp.os.msdos.djgpp |
Subject: | Making C++ little easier to beginners... |
Date: | Thu, 18 Oct 2001 16:21:29 +0300 |
Organization: | SAUNALAHDEN asiakas |
Lines: | 42 |
Message-ID: | <9qmkrh$581$1@tron.sci.fi> |
NNTP-Posting-Host: | mmmcccxxiv.hdyn.saunalahti.fi |
Mime-Version: | 1.0 |
X-Trace: | tron.sci.fi 1003411121 5377 195.197.47.24 (18 Oct 2001 13:18:41 GMT) |
X-Complaints-To: | newsmaster AT saunalahti DOT fi |
NNTP-Posting-Date: | 18 Oct 2001 13:18:41 GMT |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.50.4522.1200 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id f9IDU2a19125 |
Reply-To: | djgpp AT delorie DOT com |
Little example... int x = 10, y = 10; if(x == 10 && x == 10) // Does this look scary or weird to you ? cout << "true\n"; else cout << "false\n"; wouldnīt this be nicer ? if(x EQUAL 10 AND y EQUAL 10) cout << "true\n"; else cout << "false\n"; Hereīs little helper... #define AND & #define COMPLEMENT ~ #define EQUAL == #define EQU EQUAL #define NOT ! #define OR | #define XOR ^ As you can see the things "AND" & "OR" defined here are "bit" operators not "logical" operators. However, there really is no difference becourse you can use these two just as easily in "if" statementīs as in bit manipulation. All calculations done in computer, from the simplest addition to the most complex 3rd grade (or greater) root solving uses these operatorīs and their compinations inside the microprocessor. "Traveler2001AD" traveler AT netti DOT fi
webmaster | delorie software privacy |
Copyright Đ 2019 by DJ Delorie | Updated Jul 2019 |