Message-ID: <000201c15a5a$fefaf2a0$4851c7cb@a> From: "Siddhartha" To: References: <9qmkrh$581$1 AT tron DOT sci DOT fi> Subject: Re: Making C++ little easier to beginners... Date: Sun, 21 Oct 2001 23:32:58 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Reply-To: djgpp AT delorie DOT com ----- Original Message ----- From: "Traveler" Newsgroups: comp.lang.c++,comp.os.msdos.djgpp To: Sent: Thursday, October 18, 2001 6:51 PM Subject: Making C++ little easier to beginners... > 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 > Hey maybe you should get this patented! Experts might find your suggestions idiotic , but maybe beginners like it , infact i think its ok ... but u see by hiding simple intricacies like operators from beginners , you might be making them weaker , a lot of times (at least at my school where we learn C++ in our ciriculum ) we have some questions where we have to predict the result of an expression , which uses all the basic operators that you changed to your liking using preprocessor macros. Remember its not a war b/w boolean and C++ ... its about rules , when the syntax and semantic standards for a programming language are defined , they are done so for the convenience of the programmers , i.e to make code much more readable and easier to program. If you think you can embellish the legibility then you are welcome , but you should remember that in such course you are depriving the beginners you wish to help of the much needed practice they can get on simple operators! Enjoy !