List different methods for field
organization.
Continue with the company class;
use fixed length ,
use length indicator,
u...
Dr. Hussien M. Sharaf 3
Fixed
length
Variable length
Length
indicator
Field
delimiter
Keyword
=Value
Like Tags of
HTML and...
Each field has a fixed length of bytes.
The length must be the max expected length.
Problems:
1. The estimation of max len...
a) Length indicator:
To store the field length just ahead of the field.
Problems:
1. The field length must not be too long...
b) Field delimiter:
To choose a special character that will not appear
within a field and then insert that after each fiel...
c) Keyword = Value:
• The field provides information about itself by using a
keyword to identify each field.
Example: last...
Dr. Hussien M. Sharaf 8
User Interface
Classes containing any
processing of data
//Declarations
while (ExitProgram!=true)
{ //take user choice
switch (UserChoice)
{ case 'I':
case 'i':
//handle user Choi...
1. Start by determining Output.
2. List the inputs.
3. Think about processing.
Continue using the CompanyInfo class:
In assignment #3 we overloaded operators to read and write
comma delimited fields.
A...
Continue using the CompanyInfo class:
Write a method(not an overloaded operator) that
takes in istream and reads from it a...
Next week is the deadline.
No excuses.
Don’t wait until last day.
I can help you to the highest limit within the next
3 da...
1. Delete the “bin” and “obj” folders.
2. Compress the solution folder using
winrar.
3. Rename the compressed file as foll...
CS215 - Lec 4  single record organization
CS215 - Lec 4  single record organization
Upcoming SlideShare
Loading in...5
×

CS215 - Lec 4 single record organization

330

Published on

Reading/writing a single records

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
330
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

CS215 - Lec 4 single record organization

  1. 1. List different methods for field organization. Continue with the company class; use fixed length , use length indicator, use delimiter, use KeyWord. Dr. Hussien M. Sharaf 2
  2. 2. Dr. Hussien M. Sharaf 3 Fixed length Variable length Length indicator Field delimiter Keyword =Value Like Tags of HTML and XML
  3. 3. Each field has a fixed length of bytes. The length must be the max expected length. Problems: 1. The estimation of max length. 2. The choice of a character to fill the remaining space. Dr. Hussien M. Sharaf 4
  4. 4. a) Length indicator: To store the field length just ahead of the field. Problems: 1. The field length must not be too long (less than 256 bytes) to be stored in a single byte. 2. Needs more programming effort. 3. Requires at least two disk trips for each field. Dr. Hussien M. Sharaf 5 2. Variable length fields
  5. 5. b) Field delimiter: To choose a special character that will not appear within a field and then insert that after each field . Problems: 1. The choice of a delimiter character that does not get in the way of processing (ex. White space is not a good choice cause the field may contain spaces within it like “address fields” same for @). Dr. Hussien M. Sharaf 6 Continue Variable length fields
  6. 6. c) Keyword = Value: • The field provides information about itself by using a keyword to identify each field. Example: last=sharaf first=hussein. • It is often combined with another format (like delimiters) to separate each value from the keyword of the following field. Advantages: 1. It is easy to say which fields are contained in a file. 2. It is a good format for dealing with missing fields. Dr. Hussien M. Sharaf 7 Continue Variable length fields
  7. 7. Dr. Hussien M. Sharaf 8 User Interface Classes containing any processing of data
  8. 8. //Declarations while (ExitProgram!=true) { //take user choice switch (UserChoice) { case 'I': case 'i': //handle user Choice case'E': case'e':ExitProgram=true; break; } } system("pause"); Dr. Hussien M. Sharaf 9
  9. 9. 1. Start by determining Output. 2. List the inputs. 3. Think about processing.
  10. 10. Continue using the CompanyInfo class: In assignment #3 we overloaded operators to read and write comma delimited fields. Add a method(not an overloaded operator) that takes in ostream and writes to it a company record. 1. Fields have length indicator of type short. 2. Modify the driver(main) to use this class based on the template Menu. Example: 03155 03All 15A-z Maintenance 05Malek 01- 32902 Bestel Avenue - Garden Grove.. Dr. Hussien M. Sharaf 11
  11. 11. Continue using the CompanyInfo class: Write a method(not an overloaded operator) that takes in istream and reads from it a company record. 1. Fields have length indicator of type short. 2. Write a driver to use this class based on the template Menu. Example: 03155 03All 15A-z Maintenance 05Malek 01- 32902 Bestel Avenue - Garden Grove.. Note that the first two bytes are the length indicator. Dr. Hussien M. Sharaf 12
  12. 12. Next week is the deadline. No excuses. Don’t wait until last day. I can help you to the highest limit within the next 3 days. Dr. Hussien M. Sharaf 13
  13. 13. 1. Delete the “bin” and “obj” folders. 2. Compress the solution folder using winrar. 3. Rename the compressed file as follows: StudentName_ID_A4.rar StudentName_ID_A5.rar 4. Email to: n.abdelhameed@fci-cu.edu.eg with your ID in the subject. Dr. Hussien M. Sharaf 14
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×