|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Mondsreitersmann
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
|
This one compiles but hangs when the Percentil function is called.
Any suggestions? Here is the program TIA
__________________
Darum still, füg' ich mich, wie Gott es will. Nun, so will ich wacker streiten, und sollt' ich den Tod erleiden, stirbt ein braver Reitersmann. |
|
|
|
|
|
#2 |
|
Mondsreitersmann
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
|
Forgot to add the .dat file.
Just change the extension from txt to dat, please. |
|
|
|
|
|
#3 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
Line 141, in function Percentil:
Code:
while (i<index);
{
// ...
Hehe, it took me a while to notice that semicolon
|
|
|
|
|
|
#4 |
|
Mondsreitersmann
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
|
I am such a noob!!!
![]() Thanks, aym. |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
not really, it happens all the time, a couple of days ago I spent an hour or so trying to find out what was wrong with a small program I've written, after lots of looking here and there, it turned out that I used 1 / 3 which evaluates to 0, my bad, should have used 1.0 / 3.0
Last edited by aym; 04-01-2004 at 12:59 PM. |
|
|
|
|
|
#6 |
|
Mondsreitersmann
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
|
Aym, is there a way to make the histogram in a more efficient manner? I mean, another coding that can yield the same result without being that long?
TIA |
|
|
|
|
|
#7 |
|
Gremlin Overlord
Join Date: Apr 2003
Location: Australia
Posts: 2,382
|
Don't feel like a newbie NK, the average professional programmer makes 21 errors/1000 lines, and after checking over it once this only drops to 3 errors/1000 lines
|
|
|
|
|
|
#8 | |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
Quote:
Code:
pci becomes pc[ i ] perci becomes perc[ i ] pi becomes p[ i ] Code:
while (val_i < index) {
for (i = 0; i < 10; i++) {
if (value[val_i] >= i * 10 && value[val_i] < (i + 1) * 10 ||
value[val_i] == 100 && i == 9) {
perc[i]++;
break;
}
}
val_i++;
}
for (i = 0; i < 10; i++) {
p[i] = (float)perc[i] / (float)index;
pc[i] = (int)perc[i] * 100;
}
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|