FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Output formatting

Description
The printing format for real numbers may be changed individually with the function strfmt or by resetting the parameter REALFMT. The function strfmt may also be applied to strings, for instance to change the alignment of the text.

Further explanation of this example: 'Mosel User Guide', Sections 10.1 Producing formatted output and 10.3 Real number format


Source Files

Data Files





fo.mos

(!******************************************************
   Mosel User Guide Example Problems
   ================================= 

   file fo.mos 
   ``````````` 
   Formatted output printing.
 
   (c) 2008 Fair Isaac Corporation
       author: Bob Daniel, 2002
*******************************************************!)

model FO
 parameters
  r = 1.0         ! A real
  i = 0           ! An integer
 end-parameters

 writeln("i is ", i)
 writeln("i is ", strfmt(i,6) )
 writeln("i is ", strfmt(i,-6) )
 writeln("r is ", r)
 writeln("r is ", strfmt(r,6) )
 writeln("r is ", strfmt(r,10,4) )
end-model

Back to examples browserPrevious exampleNext example