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 functions strfmt, textfmt, formattext 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
By clicking on a file name, a preview is opened at the bottom of this page.
fo.mos[download]
numformat.mos[download]
transport2.mos[download]
transport2t.mos[download]

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