1 / 5

MET 50

MET 50. MAKING YOUR OUTPUT LOOK NICE!. The “IF” statement. Suppose we have the statements: REAL, parameter :: GRAV = 9.81 PRINT*, ‘Value of GRAV is:’,GRAV Might produce: Value of GRAV is: 9.81000000 Can we make this more “attractive”?. The “IF” statement. Yes!

keon
Download Presentation

MET 50

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MET 50 MAKING YOUR OUTPUT LOOK NICE!

  2. The “IF” statement Suppose we have the statements: REAL, parameter :: GRAV = 9.81 PRINT*, ‘Value of GRAVis:’,GRAV Might produce: Value of GRAV is: 9.81000000 Can we make this more “attractive”? MET 50, FALL 2011, CHAPTER 5 PART 1

  3. The “IF” statement Yes! We can use a more sophisticated PRINT statement. “old” PRINT*, GRAV “new” PRINT nn, GRAV nn FORMAT (stuff) MET 50, FALL 2011, CHAPTER 5 PART 1

  4. The “IF” statement “new” PRINT nn, GRAV nn FORMAT (stuff) The FORMAT statement is new. “nn” is called a label number, and must be an integer. The PRINT line tells the compiler to look for the “nn” label for printing instructions. Specifically – format instructions (contained in “stuff”) MET 50, FALL 2011, CHAPTER 5 PART 1

  5. The “IF” statement NOTES… There are several ways to set this up…we will see them thru the semester. Use the PRINT command to print output to the screen. Use the WRITE command to print output to the printer or a data file (later). MET 50, FALL 2011, CHAPTER 5 PART 1

More Related