Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Programming

No description
by

Tsui Hok Sing

on 9 December 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Programming

End
Initialization
Option 1: Add staff record(cont'd)
Option 3: Change staff record
Option 4: Remove staff record
ICP Group Project (Group 2)
Tsui Hok Sing Stanley
Tai Lok Chun

Initialization (cont'd)
Initializing the STAFF.TXT
If there have any special cases casing the STAFF.TXT cannot be read or create...
Our program will prompt user the txt is unable to open or create.
Main function
Option 1: Add staff record(cont'd)
Option 3: Change staff record
Option 3: Change staff record
Option 4: Remove staff record
Option 5: Terminate the execution and quit the system
Individual Part for Extra Function(By Owen)
Individual Part for Extra Function(By Stanley)
First of all, we need to declare the necessary header
We need the <stdio.h> header for simple operation and file operation(e.g.:fseek, *fp)
We need the <string.h> header for implementing functions about strings(e.g.:scanf(%s),gets)
It is the function for forcing user to delete the existed record and it is the "GOTO" label function
Line85:Goto statement(line157)
line157:the DELETELOOP statement
Header
We initialize the file pointers for the subfunctions
Also, we have use the structure function for presenting the variables more clearly
Line164:create the temp txt
Line:165move record to starting of file
Line168:Match the entered record with the staff.txt record
Line170:move all record except the detected record to temp txt
We use 51 character space to store the staff's name because every string inputted would have the "\0" at the end bit.
the recsize is the dynamic size of each record per staff. Hence we can save the space for storing staff records. (No need to assign 51 bits for every user)
Line 37: Store the number of staff records
This part is use for close the file and quit the program
Line187:close the file
Line188:quit the program
Initializing the STAFF.TXT
We open the STAFF.TXT with binary read and write mode if it is exciting in the containing directory.
If the STAFF.TXT is absented, we will create a new one.
eg
My individual Extra function is find above $30000 salary staff in the record of staff.txt
Line195:read and fetch record of the file
Line196:If staff salary is more than $30000
Line197:show all more than $30000 salary staff
eg
Line 45: ensure this main function is infinite loop (except the EOF and option 5)
Line 46: ensure the command prompt is clean and clear
Line 56: ensure the "ENTER"(return) will not have interference to the getche() function on line 57
Line 57: Accept the user input automatically without pressing enter

Option 1: Add staff record
We use the switch function rather than the nested-if statement, which can minimize the complexity of the function.
Line 63: Also we ensure the point is pointing to the end of the page, to prevent any error happening
line 66: we initialized the another to "y", which means it is "YES" for adding new record.

Alert user if the number of records is existing 100
Show the number of existing record
and the number of record(s) user need to delete

Line123:This line for accept the string for user
Line125:This line for fetch all record from file
Line128:match the entered staff name to the same staff name in the txt file
Line129:acknowledge user to modify the staff information
Option 1: Add staff record(cont'd)
Line143:if entered staff name is not found
Line145: let the user input other staff name to modify
Line 86: Accumulate the number of staff's records
Line 87: Write the record into the STAFF.TXT which storing by the variables
Ask user to add another record or not
Option 2: Display staff record
Line 97: move the file pointer to the start of the file, to ensure all records will be shown form start to the end

Line 98: Read the file and fetch the record one by one

Line175:Remove the original staff.txt file
Line:176:Rename the temp txt to staff txt
Line177:open the staff.txt file
Add the choice for user to select in the main menu
Ask user to input the salary
User can filter the staff records by their salary
Individual Part for Extra Function(By Stanley)
Line 186: to compare the user inputted value and the records
Thank You!
Full transcript