From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: Justification Date: Sun, 10 May 1998 11:30:59 -0400 Organization: Cornell University (http://www.cornell.edu/) Lines: 46 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <3555C833.8EC76B7A@cornell.edu> References: <3554CEB2 DOT 60C442D2 AT beverly-hills-ca DOT com> NNTP-Posting-Host: cu-dialup-1606.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jonathan Summers wrote: > Hopefully this has a simple answer. > > How do you right justify using fprint, so that it comes out looking > like: > > 123.45 > 12.34 > this question is really off-topic. for basic c questions, try comp.lang.c or comp.lang.c.moderated, and their faq. also, do make a habit of reading the docs. #include #include #include #define COUNT 10 #define MAX_VALUE 1000.0 int main(void) { int i; double a[COUNT]; srand(time(NULL)); for(i = 0; i < COUNT; i++) { a[i] = (double)( MAX_VALUE*(((double) rand())/RAND_MAX) ); printf("%8.2f\n", a[i]); } return 0; } -- ---------------------------------------------------------------------- A. Sinan Unur Department of Policy Analysis and Management, College of Human Ecology, Cornell University, Ithaca, NY 14853, USA mailto:sinan DOT unur AT cornell DOT edu http://www.people.cornell.edu/pages/asu1/