Read file, write to array, find min and max
-
I can't really do your homework for you, you won't learn anything that way. Besides, you are 90% there, just take the time and figure it out, you're almost done. -- Rocky Dean Pulley
-
I can't really do your homework for you, you won't learn anything that way. Besides, you are 90% there, just take the time and figure it out, you're almost done. -- Rocky Dean Pulley
-
Yes, but how can i write big10489=biggest(&table[1048800], 100); ? This will take a lot of my time. And i don?t now, if file is so long?
dr.eu wrote: Yes, but how can i write big10489=biggest(&table[1048800], 100); ? Exactly like that. This assumes that you have read at least 1,048,900 numbers from the file.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
Yes, from that almost i am gona crazy. The result is O.K. (for all numbers in file). Help me please with 100, 200, ... elements in array !!!
just use the same array, once you hit a number where (current_number % 100 == 0) then do your biggest/smallest check and reset current_number to 0, keep going on after that and it will just reuse your 100 item array. -- Rocky Dean Pulley
-
dr.eu wrote: Yes, but how can i write big10489=biggest(&table[1048800], 100); ? Exactly like that. This assumes that you have read at least 1,048,900 numbers from the file.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
just use the same array, once you hit a number where (current_number % 100 == 0) then do your biggest/smallest check and reset current_number to 0, keep going on after that and it will just reuse your 100 item array. -- Rocky Dean Pulley
-
I done so: while (fscanf(in,"%f",&element) != EOF) { table[num_elements] = element; current_number=element; current_number%100==0; num_elements++; } but steel dont work propertly.
How about:
while (...)
{
table[num_elements] = element;
num_elements++;
if ((num_elements % 100) == 0)
{
biggest(...);
smallest(...);
num_elements = 0;
}
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
How about:
while (...)
{
table[num_elements] = element;
num_elements++;
if ((num_elements % 100) == 0)
{
biggest(...);
smallest(...);
num_elements = 0;
}
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
I try, but compiler return erors: too few arguments to function `float * biggest(float *, int)' at this point in file too few arguments to function `float * smallest(float *, int)' at this point in file
I don't mean to sound mean but you should really be able to figure that one out. -- Rocky Dean Pulley
-
I don't mean to sound mean but you should really be able to figure that one out. -- Rocky Dean Pulley