GIDForums  

Go Back   GIDForums > Computer Programming Forums > Miscellaneous Programming Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Jul-2008, 22:08
Leaves Leaves is offline
New Member
 
Join Date: Jul 2008
Posts: 4
Leaves is on a distinguished road

How to find if a variable is between 2 numbers


Hi, how would you use "if" to find if variable A is between 40 and 100?
CPP / C++ / C Code:
if ( A = < 100 )
+
if ( A = > 40 )
//I know that's wrong but maybe you'll know what I mean better.
  #2  
Old 31-Jul-2008, 08:39
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 761
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: How to find if a variable is between 2 numbers


You'll need to apply the AND (&&) operator:
CPP / C++ / C Code:
// in C code:
if( A <= 100 && A >= 0 )
{
// do stuff here
}
  #3  
Old 01-Aug-2008, 00:31
Leaves Leaves is offline
New Member
 
Join Date: Jul 2008
Posts: 4
Leaves is on a distinguished road

Re: How to find if a variable is between 2 numbers


COol thank you
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to find the size of variable length array inside a structure Iamstupid C Programming Language 4 15-Oct-2007 11:23
loop to find only odd numbers Avalanche C++ Forum 3 05-Aug-2007 13:02
Linear Search eccoflame C Programming Language 3 19-Apr-2005 08:36
Program that will find the first 4 perfect numbers????? bicknell83 C Programming Language 3 30-Mar-2005 01:35

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 09:33.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.