![]() |
|
#1
|
|||
|
|||
Problem with looping.Hi all.
I am having a problem with my loop. I need anyone here explain to me whats going on with the code below. Input euc_total[cluster][i]: 1.0000 0.0000 2.8284 4.2426 5.0000 4.2426 1.4142 0.0000 CPP / C++ / C Code:
In the function above, I have 2 printf. The first printf will display the "min" value and "cluster" value. The problem is, it will display cluster 1 only, and I am wondering why it doesnt display starting with cluster 0. Output: min= 1.4142 cluster=1 min= 0.0000 cluster=1 The second printf has no such problem. It displays starting from cluster 0. Output: 1.0000 -> Document [0] in cluster [0] 0.0000 -> Document [1] in cluster [0] 1.4142 -> Document [2] in cluster [1] 0.0000 -> Document [3] in cluster [1] I am thinking why the first printf cant display cluster starting with 0 while the second printf can do that?? Anyone..pls explain. And how to solve this problem. Thanks in advance. Last edited by LuciWiz : 04-Oct-2005 at 00:55.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#2
|
|||
|
|||
Re: Problem with looping.Is this a full code or part. Many things are undeclared like ROW,euc_total etc... And didn't understand a thing.
__________________
PLEASE JOIN MY NEW FORUM http://singerboy.999.org |
|
#3
|
||||
|
||||
Re: Problem with looping.hi...
you assigned min as: Quote:
Quote:
can you understand? so everytime, only when the cluster goes above 1, there is a chance for the condition inside the if statement to be true. only if the condition in the if statement is true, the value of cluster will be assigned to clust... else the value of clust will be zero.. so there is a chance that your second printf can print the cluster to be zero.. may be you can post your full code and tell what you need.. because i dont understand your program completely... i compiled the following the program(same as yours) CPP / C++ / C Code:
but i got the result as: Quote:
else the value of clust will be the same as the one in your previous loop.. you can also check your program by giving different values of euc_total... bye... Paramesh |
Recent GIDBlog
Welcome to Baghdad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Graphic problem in Unreal Tournament 2004 | zerox | Computer Software Forum - Games | 10 | 09-Oct-2005 12:31 |
| a significant problem after installing Xp | mohammad | Computer Software Forum - Windows | 10 | 09-Aug-2005 07:03 |
| String problem | vaha | C Programming Language | 3 | 24-May-2005 18:21 |
| Another FX 5600 problem (but with details that might shed light on this) | BobDaDuck | Computer Hardware Forum | 2 | 16-Apr-2004 07:53 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The