...And why should you post a solution once the time is up?
The code is bad practice too.
Not to mention unnecessarily complicated and hard to understand.
Printable View
...And why should you post a solution once the time is up?
The code is bad practice too.
Not to mention unnecessarily complicated and hard to understand.
??Code:const char *pDay[] = {"Sunday", "Monday",
"Tuesday", "Wednesday",
"Thursday", "Friday",
"Saturday"};
--
Mats
Yep, that takes care of the bad practice part... But the code is still too complex to understand right away without digging into the code and I am not going to bother to.
I dunno, seems like you need to understand two things predominantly: functions and arrays. The algorithm Bob used is pretty well known, it only requires some moderate research if you don't know.Quote:
Yep, that takes care of the bad practice part... But the code is still too complex to understand right away without digging into the code and I am not going to bother to.
You must hate programming then.
Actually, I do not.
Though technically a program is algorithms and data, I can still hide the algorithms in higher-level functions whose task is clear. Now that is what programming is about.
I was referring to the MS compiler.
I remember what Lint is. I sure do hope it points that out. Otherwise I think someone needs to file a suggestion...
Hmm.... What is algorithm? :P
No, English ain't my main language and you people make it sound as algorithm is an essential part of coding, so could anyone clear it up for me? 'Cause dictionaries don't really make sense, when I search 'algorithm' :P
"A precise step-by-step plan for a computational procedure that begins with an input value and yields an output value in a finite number of steps. "
Or in other words - it describes the process of taking a number from the user and calculates to 1000 from that number.
Ohh... So it always calculates to a 1000? Or is that controllable?
I disagree after "in other words" ... algorithms apply to any problem, even in real life. If you lost something you would probably use an algorithm to find it. Like, "well, I know I had it an hour ago, I'll retrace my steps to where I was an hour ago."
That's probably the reason my psychology textbook and computer science textbook agree that an algorithm is a step-by-step procedure for solving a problem in a finite amount of time. Even though, in psychology they usually focus on how this applies to the conscious mind and learning.