Need help with center justification 
Author Message
 Need help with center justification

Quote:
> How to center justify numeric output.

 Use an internal write to put the numbers into a string,
 then print the string with space padding.  If that little
 blurb doesn't point you in the right direction, let me
 know and I'll dig up a short code sample.

 Lee



Sat, 23 Aug 1997 22:30:38 GMT  
 Need help with center justification
Quote:
>Subject: Need help with center justification

>Date: 7 Mar 1995 00:42:44 GMT

>Can anyone tell me how to center justify a formatted output?
>The number and size of arguments is dependent on input.
>(ie it could be "10" or it could be "10   20    30")
>Thanks.



>or just Craig

One technique (not necessarily the best is as follows) ...

      Subroutine CenterTitle(Title,Length)
c----------------------------------------------------------------------+
c     This subroutine centers a title by elimating 1/2 trailing " "s.  |
c----------------------------------------------------------------------+
      Character*(*) Title
      Integer Length,Blanks,i

      Blanks = 0
      Do  i = Length , 1 , -1                ! Starting on the right side
        If( Title(i:i) .ne. ' ' ) goto 33    ! Check for Trailing blanks
        Blanks = Blanks + 1                  ! Count the blanks
      Enddo

  33  Continue
      If ( Blanks .gt. 1 ) then
      Blanks = Blanks/2                      ! Cut half of the blanks
        Do i = Length , 1 , -1
          If ( i-Blanks .gt. 0 ) Title(i:i) = Title(i-Blanks:i-Blanks)
          If ( i-Blanks .le. 0 ) Title(i:i) = ' '     ! Blank front half
        Enddo
      Endif
      End



Sun, 24 Aug 1997 00:15:41 GMT  
 Need help with center justification
Can anyone tell me how to center justify a formatted output?
The number and size of arguments is dependent on input.
(ie it could be "10" or it could be "10   20    30")
Thanks.



or just Craig



Sat, 23 Aug 1997 08:42:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need help on off-center rotation

2. Newbie...Need Help Centering String Data

3. Newbie...Need Help Centering String Data

4. Clipper POS app needs PICTURE clause for numerical right-justification

5. Help with text justification in Turbo Prolog

6. Centering Text Help

7. Centering Text Help

8. help me, machining center processing simulation program using VRML

9. help centering string1 into string2

10. Help with calc'g volume and center of mass when given vertices

11. Size and center window - HELP

12. Help: centering a dialog box over a window?

 

 
Powered by phpBB® Forum Software