The objective is to get the series up to the 10th element. I already know what's the problem on this one. the element 17,179,869,184 is really impossible for 4-bit data type like unsigned long long int. All it needs is a new compiler and/or a new library that can process 8-bit data type, as unsigned long long int is still a 4-bit data type. Am I right?
Has four bytes become more than 32 bits when I wasn't looking?
In the header file limits.h and/or values.h, you have the info on your compiler's max data - for every data type. Pulling some data from both of them, you have:
This is in Turbo C ver. 1.01.Code:#define MAXDOUBLE 1.797693E+308 #define ULONG_MAX 0xFFFFFFFFUL
So it's clear that double has WAY more range than you need, if you want to use it, and unsigned long, doesn't have the range to handle it all.
If you don't want to work with a double for some reason, and assuming that you need to stay with Turbo C because your teacher requires it (or your program will be tested on a Turbo C compiler), the other way is to use either an array and work with the digits one by one, like you were multiplying by hand.
We just had a thread on this recently, here.
Pelles C.. short int = 2 bytes, int and long int = 4 bytes, long long int = 8 bytes.
Stop messing around with antique 16 bit compilers. Get something up to date.
This is just one of many reasons why Turbo C should be shoveled into a large pile and burned.
Last edited by CommonTater; 08-15-2011 at 07:46 PM.
What good will it do him to get a better compiler if his program will be graded based on the teacher's compiler, which is Turbo C?
He could code up a great program, but still get an F grade on it.
Of course, he can use a better compiler - starting the day after his Turbo C teacher's class is over.
Me? I'd write the program in Pelles C and drive the point home hard!
"Turbo C can't do this... look how easily this does it.... Teach, it's time for you to get with the times!"
Nothing changes until someone has the temerity to demand change... I feel so sorry for these guys their teachers are ruining their chances of a very good career...
Last edited by CommonTater; 08-15-2011 at 07:58 PM.
Do you REALLY believe his teacher will want a student to show him how "backward" he is? 'Cause right off the bat, I'm thinking "Oh hell no!".
My first day in class, we were told what compiler the programs we submitted would be graded on. We had a choice of Turbo C or Turbo C. If our programs wouldn't compile, or wouldn't produce accurate results, they were graded down - naturally.
This was decades ago, but that is where I believe these students are today. They're told to use Turbo C, and their programs will be graded according to how they compile and run, on a Turbo C compiler - ONLY.
Some of these students are running DOS for their OS. How will they run Pelles C, in that case?
You know I'm a big fan of Pelles C, and they should move up to a better compiler as soon as they can - but not at the risk of failing their class.
Pelles C is FREE it would cost the university exactly NOTHING to make the move so there is no excuse for this... none whatsoever.
My first day in electronics training, I realized right away that I knew more about the wonders of moving electrons than my teacher did... Wound up working the year as his TA... and helping him update his curriculum... You know, things like ... "We do that with transistors now...." At the end of it, the Dean of the school shook my hand and thanked me.My first day in class, we were told what compiler the programs we submitted would be graded on. We had a choice of Turbo C or Turbo C. If our programs wouldn't compile, or wouldn't produce accurate results, they were graded down - naturally.
But it's not really about the university... it's about bad teaching sabotaging what might otherwise be a brilliant career...This was decades ago, but that is where I believe these students are today. They're told to use Turbo C, and their programs will be graded according to how they compile and run, on a Turbo C compiler - ONLY.
Yet another thing that desperately needs fixing.Some of these students are running DOS for their OS. How will they run Pelles C, in that case?
Which is worse... failing one class out of progressive defiance or failing your entire career out of resignation?You know I'm a big fan of Pelles C, and they should move up to a better compiler as soon as they can - but not at the risk of failing their class.
Admirable sentiment, but whether a bottom-up approach actually works depends on the culture of the institution, and I have a feeling that it will not work in Indian universities, especially given what Salem's link cites. Sometimes a student really has no choice but to play along with eyes wide open until he/she graduates and has a say because the alma mater wants his/her money in donations. Of course, if the student or his/her parents has the money and/or influence then it could be a different story, but otherwise just because many students demand for something does not mean they will get it.Originally Posted by CommonTater
Not really. There are "menu costs" of changing course materials and updating the computers, but then this should be the norm for such courses anyway.Originally Posted by CommonTater
If that one class is an early pre-requisite, then failing that one class could mean failing to obtain the degree.Originally Posted by CommonTater
As a one time technical trainer my heart really goes out to these guys. I *know* how much damage an out of date curriculum can do and worked very hard keeping mine up to date. It was an industrial course, but some of the guys I had to teach from scratch, so giving them the best information was a very high priority both for me and for the company itself. One of the other teachers just cruised along with older notions and once the techs got wind of how out of date he was, he found himself, soldering iron in hand, as a lead technician in a branch office. There was so much pressure we almost had to fire him.