forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Formatting a value

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
SaintMichael57



Joined: 28 Nov 2016
Posts: 12

PostPosted: Sat Jan 27, 2018 6:16 pm    Post subject: Formatting a value Reply with quote

Dear Silverfrost Community:
Can someone format a numerical value so that it is in the form of the U.S.
currency (dollars and cents)? Thank you. Smile
Back to top
View user's profile Send private message
simon



Joined: 05 Jul 2006
Posts: 152

PostPosted: Sat Jan 27, 2018 7:37 pm    Post subject: Reply with quote

Code:
Program dollars_cents
Character(Len=16) :: c
Real :: v

Read (Unit=*, Fmt=*) v
Write (Unit=c, Fmt='(F16.2)') v
c = '$' // Adjustl(c)
Print *, c
End Program dollars_cents
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1974
Location: Sydney

PostPosted: Sun Jan 28, 2018 6:38 am    Post subject: Reply with quote

Write (*, Fmt='(" $",f0.2)') v

You could also search for Business Editing in FTN95.chm
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group