Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 15th, 2006, 8:39 PM   #1
jobobshishkabob
Programmer
 
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0 jobobshishkabob is on a distinguished road
If x=y, then go here...

this is a stupid question, i know....

If i say..

if x==y... i want to set y a side, so i can also keep on saying...
if x==a
if x==b
if x==c....

i want to set them all aside in a side in a list, then after it is done, i want it to display a, b, c, y, etc....

how would i do that?
jobobshishkabob is offline   Reply With Quote
Old Feb 15th, 2006, 8:46 PM   #2
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
i don't understand your question
Master is offline   Reply With Quote
Old Feb 15th, 2006, 8:55 PM   #3
jobobshishkabob
Programmer
 
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0 jobobshishkabob is on a distinguished road
ok... i was afraid i didnt word it properly....

ok so i have some random letters...
atcgatcatcatc and
acatatcgagacatc
(for example, the ones i will be using are much longer)

i know this isnt the most efficient way, but i want to say like

x(1)=atcg
x(2)=catc
y=acat
a=catc
z=atcg

and i want to say...

(x meens x(1) or x(2))
if x=y, then set y aside... if x does not = y, then ignore
if x=a, then set a aside... if x does not = a, then ignore
if x=z, then set z aside... if x does not = z, then ignore

in this case, the program will have set a and z aside because a(catc)=x(2) and z(atag)=x(1)... and y would be ignored becuase it =s neither x(1) or x(2)...

now i want it to go to a new page and display in a list all of the things it set aside.... so it would display

Both contained:
atag
catc

i hope you understood that.... sorry for the confusion
jobobshishkabob is offline   Reply With Quote
Old Feb 16th, 2006, 12:05 AM   #4
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
I still dont understand
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain

Destruction leads to a very rough road, but it also breeds creation.
bigguy is offline   Reply With Quote
Old Feb 16th, 2006, 1:21 AM   #5
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
So you just want to parse some long strings and look for certain shorter substrings, while recording any strings that match the search string? And in your example, are y, a, and z each a possible random string that could be of arbitrary length?

Maybe more to the point, do you have any code?
Jimbo is offline   Reply With Quote
Old Feb 16th, 2006, 8:01 AM   #6
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
I think he want to split the text, since he did something like this
str = atcgatcatcatc
str.split('at')
Master is offline   Reply With Quote
Old Feb 16th, 2006, 9:44 AM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Frankly, if you can't express yourself clearly to a human, how do you expect to express yourself clearly to your machine? It's a lot less able to draw inferences. All of your respondents are trying to read your mind, and that doesn't work really, really well. Think out your problem, precisely what you want and need to do, and try to formulate it in programming language terms. "i want to set them all aside in a side in a list." Say that out loud to yourself and see if you "get it."
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 16th, 2006, 10:23 AM   #8
babbling
Newbie
 
Join Date: Feb 2006
Posts: 11
Rep Power: 0 babbling is on a distinguished road
Do you mean something like this?

if( x == y && x == a && x == b && x == c )
{
  // ...
}
babbling is offline   Reply With Quote
Old Feb 16th, 2006, 11:54 AM   #9
boraciner
Programmer
 
boraciner's Avatar
 
Join Date: Nov 2005
Location: Turkey
Posts: 93
Rep Power: 3 boraciner is on a distinguished road
you can use switch-case loop....

switch( )
{

case ? : ............... break;
case ? : ............... break;
case ? :............... break;

}
boraciner is offline   Reply With Quote
Old Feb 16th, 2006, 12:17 PM   #10
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
Quote:
Originally Posted by boraciner
you can use switch-case loop....
Switch() is not a loop, it is a logic control structure. But it is a good idea to use it if you have multiple values for one variable.
OpenLoop is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC