Enee150 recitation 7
This presentation is the property of its rightful owner.
Sponsored Links
1 / 12

ENEE150 Recitation 7 PowerPoint PPT Presentation


  • 116 Views
  • Uploaded on
  • Presentation posted in: General

ENEE150 Recitation 7. Outline. Project 2 Structures. Announcements. Project 1 grades should be coming out this weekend. Project 2: ENEE Airplanes Flight Database. Parse input files, print menu, prompt user Three input files – use file I/O Airports.txt Routes.txt Flights.txt

Download Presentation

ENEE150 Recitation 7

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Enee150 recitation 7

ENEE150 Recitation 7


Outline

Outline

  • Project 2

  • Structures


Announcements

Announcements

  • Project 1 grades should be coming out this weekend


Project 2 enee airplanes flight database

Project 2: ENEE Airplanes Flight Database

  • Parse input files, print menu, prompt user

  • Three input files – use file I/O

    • Airports.txt

    • Routes.txt

    • Flights.txt

    • intargc, char *argv[]

  • If files cannot be opened, print error message


Enee150 recitation 7

Menu

  • Print for user input

    • User must enter a number: 1 – 4

    • If the number is not 1 – 4, print error message


Airports txt

Airports.txt

  • Contains 3-letter airport code and location

  • Format

    • 3-letter airport code

    • Two whitespaces

    • Airport location

    • ‘\n’ character at end of line

  • Example: BQN Aquadilla, Puerto Rico

    • Notice there are spaces within the string

    • May want to use ‘\n’ to recognize end of string


Routes txt

Routes.txt

  • Shows the non-stop flights

  • Format

    • Unique route ID (integer)

    • ‘.’ character

    • Two whitespaces

    • Departure airport code

    • Whitespace

    • Arrival airport code

  • Alphabetical order (by city) of the departure and then alphabetical order of arrival


Flights txt

Flights.txt

  • Format

    • Unique flight number (integer)

    • Route ID/number

    • Departure time

      • 12 hour format

      • ‘a’ for am and ‘p’ for pm

    • Arrival time

    • Repeat

      • ‘Daily’

      • Numbers

        • Numbers are the days that the flight runs

        • ie. 23 which would represent Monday and Tuesday

      • Xnumber

        • Numbers after ‘X’ represent days that the flight doesn’t run

        • ie. X7 which is NOT Saturday


Menu options

Menu Options

  • Option 1 – Print flights

    • Enter flight number

    • If flight doesn’t exist, print error message

  • Option 2 – Print airports

    • Enter 3-letter airport code

    • If flight doesn’t exist, print error message

  • Option 3 – Nonstop flights

    • Prompt for two airport codes

    • Prompt for days (0 means any day)

  • Option 4 – 1-stop flights

    • Same prompt and error conditions as option 3


Important notes

Important Notes

  • There will never be more than

    • 100 airports in airports.txt

    • 500 routes in routes.txt

    • 3000 flights in flights.txt

    • 2000 characters per line

    • 100 characters per string

  • String.h is allowed (strcmp?)

  • fgets

  • Structures are allowed


Checking your project

Checking Your Project

  • Get output files from website

  • Transfer them to GLUE

  • Generate your output

    • a.out< test1.in > ! output.txt

  • diff test1.out output.txt

  • Newline characters at the end of the file are ok


Structures

Structures

  • Group different types together

  • Usually use typedef

  • Pass by value (as oppose to pass by reference)

  • struct.c


  • Login