Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@cosinusdealfa unless this quizzes and students program gets released i see no problem with it. :)
-
Paralax13818yShouldn't the counting var be initialized IN the for-loop? At least that's how I learnt it
-
@Paralax it is initialized as part of the 'for' statement e.g. i = 0. If you initialized it inside the 'for' it would loop forever as the counter would keep being effectively reset during each new loop.
-
@Paralax really depends, I know some versions of C don't support the for (int i = 0;;) {} syntax.
-
cipher6498y@cosinusdealfa
I need it to see the output in cmd, or at least that's what my professor taught us. -
cipher6498y@DrEmann
I'm not sure what you mean.
My professor hasn't mentioned scopes just yet with constants. I'll make sure to look into it! -
Just a heads up this code will throw an error if students or quizzes is equal to zero. Not sure if you need to handle that case, but just letting you know :-).
-
cipher6498y@Yankeesrule
Oh yeah I'm aware, thanks though:).
I could have went through and handled all cases but that wasn't required for my spec (this is just an assignment) and I had other things to do, normally I would have.
I should mention everyone I'm in a Intro to programming class (COP 1000) so there's no pushing to production or anything like that. 😅 -
@QuantumAtom yeah I figured it was for class but wasn't sure if it was a case you missed. Looks good other than that. Good job!
As a senior software engineer I'm pretty sure I spend way more time thinking about the crazy border cases that could potentially break my code than the happy cases. -
cipher6498y@Yankeesrule
Thank you!
But lol, if I ever do code for something more than an assignment (I'm sure I will; also at times I'll focus on bad cases depending on the assignment and my time) I'm sure I'll focus more on the bad ones as well. In your eyes do you think that's better than doing the opposite, focusing on the good cases way more than the bad ones?
I personally would think so. -
@QuantumAtom it depends on the complication to code the border cases. If it's easy, I knock it out right away. If it will be very complicated and make the code difficult to read, etc. then I will raise it up with the clients. They may say the case will never occur and so don't worry about it. And if so, case closed.
If not, I make it a separate story (basically a requirement) so I can focus on that at a separate time. At that time I will try to see if I can move whatever validations and checks are needed for it into a separate method/function so it doesn't interfere with the main business logic making things hard to read. I can then document the case and reasoning behind it at the top of the function as well without it being in the way.
But yes, it is important to think about border cases early so you can at least tell the users. And always in email so you have written proof that the issue is okay for when they change their mind :-). -
cipher6498y@Yankeesrule
Oooh yes that's very true. It can make the code complicated and hard to read.
And yeah that makes sense to ask the client and get their opinion. As if they don't think they'll come across that case and tell you not to worry, that's saving you time that you can put towards other things.
And ooh yeah I'd imagine having documentation and the proof would be very important. -
Paralax13818y@XirusDaVirus Sorry, I meant in the for-brackets e.g. for (int i=0...){}, not at the top of the function
Related Rants
!rant
First time working with 2-D arrays. Think I did good :).
undefined
array
c