![]() |
|
#1
|
|||
|
|||
LoopingDear All:
I would like to show this as following with For loop Numbers: 1,2,3,4,5 each line must be unique, for example (1,2) , (2,1) can not be show. 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5 Thanks, Li |
|
#2
|
||||
|
||||
Re: LoopingLoop INDEX1 from 1 to MAX-1
Loop INDEX2 from INDEX1+1 to MAX __________________
Cow: You're a lawyer too? Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase! |
|
#3
|
|||
|
|||
Re: LoopingIn c++ coding, how could I write as for loop?
Thanks, Li |
|
#4
|
||||
|
||||
Re: LoopingHere ya go:
CPP / C++ / C Code:
__________________
If practice makes perfect and nobody's perfect... why practice? Homepage: http://www.treywhite.com Blog: http://www.treywhite.com/blog.php Web Design Company: http://www.ewebproductions.com |
|
#5
|
||||
|
||||
Re: LoopingQuote:
__________________
Cow: You're a lawyer too? Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase! |
|
#6
|
||||
|
||||
Re: LoopingQuote:
Chill! You handle things your way, and I'll handle things my way... and the code isn't wrong (I assume you are referring to the fact that it was written in C... which I changed at some point between when you clicked to respond and when you actually posted to C++). I believe that revealing an answer in this sort of an example is just as much of a benefit as letting the person come to the answer on their own. It's not like fj8283888 was asking how to code an iteratively-deepening a* tree or anything of that nature. We are talking about loops here... in their basic form. Just like reference books, the answer is often REVEALED and then explained. It's okay to do that on these forums as well. I understand that you've been on these forums alot longer than I have... and you've probably been coding alot longer as well, but people have different ways of helping, and we don't all have to do it your way. You aren't the post police, so I don't have to do it your way, though I appreciate the way you handle situations... let me do it my way. That's it! __________________
If practice makes perfect and nobody's perfect... why practice? Homepage: http://www.treywhite.com Blog: http://www.treywhite.com/blog.php Web Design Company: http://www.ewebproductions.com |
|
#7
|
||||
|
||||
Re: LoopingQuote:
And the code is wrong. Your first loop should go from index1 < MAX not <= MAX Quote:
And at the OP's level of experience, this problem was just as difficult as "how to code an iteratively-deepening a* tree" to a more experienced programmer. Is there an experience level when types of help are permitted and not? (Rhetorical question) Quote:
Quote:
Actually, no I'm not, and no you don't. But my post IMO is wasted because of the code. I would prefer not to waste my time helping someone just to have the next poster hand them the code. That's all I mean. My post no longer has value, and the OP now has working code. Possibly nothing learned. Of course you are free to disagree with me. Differing perspectives are usually useful. I'm simply stating my opinion from of my experience. You may ignore my position if you wish, or try to understand it and accept or reject it. Your choice. Yes, only my opinion. 'nuf said. __________________
Cow: You're a lawyer too? Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase! |
|
#8
|
||||
|
||||
Re: LoopingQuote:
Either way works... in my design the conditional parameter for the second for loop is (index1+1) <= MAX... so in the case that index1 = MAX, index1+1 will be > MAX, so the inside of the second loop won't be reached. Quote:
Understood... but you had already explained what needed to be done... the OP still sounded confused, so I threw the code out there Quote:
This is probably where I messed up. You had already taken the effort to help this person, so I should have not intervened. Had I been the first response to this post and given the solution with an explanation, it would have been different. However, since you were the first to respond... and you were obviously using your method, I shouldn't have posted a solution like I did, but maybe another hint to get the answer out of them. Didn't mean to start any drama... I just didn't like getting attacked... particularly when I was trying to help as well. Perhaps (being more of a newcomer to these forums), I am a little more naive to the amount of people who only come on here for quick answers (rather than to learn)... though I'm pretty good at spotting them. Let's just say that if you're helping someone, I'll make sure not to serve up the answer to them on the metaphorical silver platter. Time for some dancing bananas.... ![]() __________________
If practice makes perfect and nobody's perfect... why practice? Homepage: http://www.treywhite.com Blog: http://www.treywhite.com/blog.php Web Design Company: http://www.ewebproductions.com |
|
#9
|
|||
|
|||
Re: LoopingGuys, Thank you so much for giving me the solution.
Be happy guys. I know you guys are helping me lot |
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| my 1st simple program, 3 slight problems. | skizer | CPP / C++ Forum | 11 | 07-Feb-2006 15:31 |
| Sample looping (do/while) | Sabin044 | CPP / C++ Forum | 8 | 04-Feb-2006 11:39 |
| Problem with looping. | rina | C Programming Language | 2 | 04-Oct-2005 06:37 |
| ask looping | likeit | C Programming Language | 4 | 26-Jul-2005 19:49 |
| for looping prob | Rosmayati | C Programming Language | 1 | 30-Jun-2004 11:39 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The