...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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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.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.
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
Currently research OpenGL
"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?
Currently research OpenGL
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.