Talk About Network

Google





Programming > C - C++ Learning > Re: beginer pro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 6 Topic 4062 of 4400
Post > Topic >>

Re: beginer programer needs help

by Ben Cottrell <bench@[EMAIL PROTECTED] > Mar 11, 2008 at 01:47 PM

Justice wrote:
> On Mar 11, 1:19 am, Triple-DES <DenPlettf...@[EMAIL PROTECTED]
> wrote:
> 
>>On 10 Mar, 19:33, Justice <foi...@[EMAIL PROTECTED]
> wrote:> I am trying to make
a simple game but have some problems
>>
>>[snip]
>>
>>I think you are confusing "=" and "==". For instance:
>>
>>  if (Buy='y')
>>
>>Should probably be:
>>
>>  if(Buy == 'y')
>>
>>etc.
>>DP
> 
> 
> oh yes I noticed that bug after I compiled and ran it, It's takeing a
> bit for my brain to unlearn that = does not mean =, == equals =,  but
> thanks
> This is really my first program of usefullness

The compiler can help you a little here, if you make a habit of always 
writing a constant on the left-hand-side of any boolean expression (when 
possible)

for example,  if( buy == 'y' )  would become

     if( 'y' == buy )


This way, if you accidentally typed a single = symbol (known as the 
assignment operator), the compiler would complain that you cannot assign 
something to 'y'.  Compiler errors are a very good thing, since they 
help you eliminate would-be bugs from your program
 




 6 Posts in Topic:
beginer programer needs help
Justice <foisys@[EMAIL  2008-03-10 11:33:59 
Re: beginer programer needs help
"Jim Langston"   2008-03-10 13:18:47 
Re: beginer programer needs help
Justice <foisys@[EMAIL  2008-03-10 15:02:46 
Re: beginer programer needs help
Triple-DES <DenPlettfr  2008-03-11 00:19:37 
Re: beginer programer needs help
Justice <foisys@[EMAIL  2008-03-11 06:40:25 
Re: beginer programer needs help
Ben Cottrell <bench@[E  2008-03-11 13:47:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 10:17:15 PST 2009.