15 Replies
the task is: there is race where it is recorded in the first line the number of race he ran
H array is the places he got
P array is the minutes it needed to finish
and Mp array is the seconds
i had to get the fastest race first and last index
so max and min
but the catch is the place must be at least 3 or 2 or 1
this input file
and it should write 4 and 5
but mine is 4 and 9
can you explain a bit more about the "catch" and the "fastest race first and last index" parts?
also, wouldnt it be easier to represent each race as an object instead of an array of each metric?
oh okay I get it now. Yeah this would be a lot easier if you modelled it as an object, like a
record
no because no struct or class
sry
wdym?
are you not allowed to use structs or classes for this particular homework?
i am lazy to do in specification
?
specification -> structogram -> code
silly for a thing like this
but to answer your question... this is not good code
it can easily be done while reading from the file, as opposed to reading all the values into weird arrays first, or even better and readable with using an object to hold the values
sir
but the code is good semantically?
no
so it doesn't do what it has to?
I mean you just said that yourself.
broooo
they are giving me a headache
probably the output file is bad
your expected value is wrong, yes
look at race 5
3 1 39
vs race 9
3 1 5
race 9 is the fastest top 3 race at 65 total seconds
race 4 is the slowest top 3 race, at 290 secondsPlease use proper naming for your variable names :oh:
How is anybody supposed to read this
What is H? What is P? What is Mp??