Making the PRINTF Look Better in G05 !! - PowerPoint PPT Presentation

1 / 2
About This Presentation
Title:

Making the PRINTF Look Better in G05 !!

Description:

Making the PRINTF Look Better in G05 !! EXAMPLE: printf ( – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 3
Provided by: bus96
Category:
Tags: printf | better | g05 | look | making | places

less

Transcript and Presenter's Notes

Title: Making the PRINTF Look Better in G05 !!


1
Making the PRINTF Look Better in G05 !!
EXAMPLE printf ("fd", a, b) / Produces
lots of decimal places for variable a..
142.101567 defaults to 6 / But you can
control the output as follows printf
("x.yfzd", a, b) / The x z specify the
total number of default places (always supplied,
more provided if needed) including the decimal
point and any sign . The y specifies the exact
number of place to the right of the decimal
point. This control allows the programmer to
better align output data. The x, y z are
optional. printf (".2fd", a, b) / Now
produces only 2 places to the right of the
decimal for variable a.. 142.10 /
2
Example
  • Say you want to print
  • The pole is 42.735 feet high
  • The pole is 4.123 feet high
  • The pole is 192.678 feet high
  • You would use
  • printf (The pole is .3f feet high\n,hgt)
Write a Comment
User Comments (0)
About PowerShow.com