Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 15th, 2002, 02:59 PM
Solmyr Solmyr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Pozarevac, Yugoslavia
Posts: 24 Solmyr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Solmyr
if problem

i write this code:

if ((($first != "+") OR ($first != "-")) AND (($last != "+") OR ($last != "-"))) {

.....

}


but not work properly...why? and can i write it in some other (better) way

Reply With Quote
  #2  
Old October 15th, 2002, 07:11 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,587 Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 21 m 5 sec
Reputation Power: 997
I think you really meant
Code:
if ((($first != "+") AND ($first != "-")) AND (($last != "+") AND ($last != "-"))) {
 ....
}

Reply With Quote
  #3  
Old October 15th, 2002, 07:20 PM
Solmyr Solmyr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Pozarevac, Yugoslavia
Posts: 24 Solmyr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Solmyr
$first is first character of string, and $last is last character of string... i mean that first character of string must not be "+" or "-" and last character must not be "+" or "-"....how do i write it?

Reply With Quote
  #4  
Old October 15th, 2002, 07:21 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,587 Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level)Scorpions4ever User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 21 m 5 sec
Reputation Power: 997
Yep, the statement that I posted above would work. Also you could remove some parenthesis if you like

Reply With Quote
  #5  
Old October 16th, 2002, 02:36 AM
Solmyr Solmyr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Pozarevac, Yugoslavia
Posts: 24 Solmyr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Solmyr
thnanx, works! (but, i do not understand why don't work my algorithm...i write like i say my if clause)

could i write it in some other, better (algorithm) way?

Reply With Quote
  #6  
Old October 16th, 2002, 06:07 PM
3dfxMM 3dfxMM is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 266 3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level)3dfxMM User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 21 h 4 m 53 sec
Reputation Power: 13
You are checking to see if the first character is not '+' or not '-'. That will always evaluate to true since it has to not be at least one of them. The same holds true for the last character. Scorpions version checks to make sure that both the first and last characters are not '+' or '-'.

Reply With Quote
  #7  
Old November 11th, 2002, 03:02 PM
tank80's Avatar
tank80 tank80 is offline
php-oriented object
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: 0x9832053
Posts: 173 tank80 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 49 sec
Reputation Power: 8
Send a message via ICQ to tank80
PHP Code:
if (($first!='+' OR $first!='-') AND ($last!='+' OR $last!='-')) 


excuse me for the php code, but it gives some syntax hilight to the thing above.
hope this helps

Reply With Quote
  #8  
Old November 11th, 2002, 03:07 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 36 m 16 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
tank, as per Scorpions code above, they all need to be 'AND' conditions, not 'OR'.

Reply With Quote
  #9  
Old November 11th, 2002, 03:17 PM
tank80's Avatar
tank80 tank80 is offline
php-oriented object
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Location: 0x9832053
Posts: 173 tank80 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 49 sec
Reputation Power: 8
Send a message via ICQ to tank80
wops...that's true! sorry
well....too late here...gotta go to bed now

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > if problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT