Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
i believe %g will achieve what you're looking for.

-Lee


I like it Lee! Thanks! Something new, yet simple. I looked it up, %g uses scientific notation (%e) or %f whichever is shorter. I assume we are in fact using %f not scientific notation based on the output below, why this %f doesn't include the extra 0's, and actually using %f instead of %g does, I don't know.

Code:
  printf ("The largest number you printed was: %g\n", current_maximum) ;
  		
  return 0 ;

Code:
Enter a number: 899
Enter a number: 878
Enter a number: 3
Enter a number: 2
Enter a number: 0
The largest number you printed was: 899
 
I like it Lee! Thanks! Something new, yet simple. I looked it up, %g uses scientific notation (%e) or %f whichever is shorter. I assume we are in fact using %f not scientific notation based on the output below, why this %f doesn't include the extra 0's, and actually using %f instead of %g does, I don't know.
<snip>

%g, on top of choosing %e or %f, also omits trailing, insignificant zeros (that's to say, after a decimal point... trailing 0s obviously matter before a decimal point) when using %f. This was the thrust of what you were looking for, or at least how i interpreted it.

-Lee
 
Okay gang, that's it for tonight! Thanks all! Going to get some other reading in tonight!

It seems I'm completing about 2 chapters a month in my C Programming book. Is that about right? I'd like to go faster, but it's the exercises that slow me down. I have 16 more to do for this chapter. I imagine in a classroom setting the professor would assign only certain problems, but I'd prefer to do them all for practice.

If studying this in a classroom setting, at the college level, do you think 1 chapter every two weeks is on par?
 
Okay gang, that's it for tonight! Thanks all! Going to get some other reading in tonight!

It seems I'm completing about 2 chapters a month in my C Programming book. Is that about right? I'd like to go faster, but it's the exercises that slow me down. I have 16 more to do for this chapter. I imagine in a classroom setting the professor would assign only certain problems, but I'd prefer to do them all for practice.

If studying this in a classroom setting, at the college level, do you think 1 chapter every two weeks is on par?

I don't think anyone can say. Everyone learns at a different rate, how much you can get through is affected by other things in your life, every book is going to have different length chapters, different level of exercises, etc.

You are going through it at the rate that is right for you. Did i have courses where we had to go through a chapter a week of a giant book? Yes. Was that reasonable? Not really. Did i learn a lot? Absolutely. Just keep at it. You are going at the pace you can go, and it's admirable that you are committed to doing all of the exercises and really "getting it".

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.