{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture-06.2.2 - program Lab6 implicit none character*9...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 1540.03 Week 6.2.2 February 8, 2012 Design of Programs Read Chapter 9 of the textbook. Appreciate the step-by-step process of breaking down a problem and how an algorithm can be made better. Pay particular attention to the sections on program specifications, defensive programming, program correctness and programming style. Example: Lab 6 The problem neatly breaks into several pieces: - the loop that requests processing a date - input a month and convert it to a number - input the day and check for valid date 1. the loop that requests processing a date program Lab6 implicit none character*1 reply do print*, "Do you want to convert a date, Y or N?" read*, reply if (reply .eq. "N" .or. reply .eq. "n") exit print*, "process a date" end do stop end 2. input a month and convert it to a number
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: program Lab6 implicit none character*9 month integer monthNum, pos character*108 months months = "January February March April & &May June July August & &SeptemberOctober November December " print*, "Enter the month name" read*, month pos = index(months,month) if (pos .eq. 0) then print*, "The month is invalid" else monthNum = pos/9 + 1 ! process day print*, month, " is month #", monthNum print*, "now process day" end if stop end 3. input the day and check for valid date if ( February ) then if ( valid day ) then output date else error message end if else if ( April, June, September or November ) then if ( valid day ) then etc. CSE 1540 Week 6.2.2 – February 8, 2012 page 1 of 1...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern