Help me to solve this C++ problem

T

titi

Question

The road and traffic authority for a small country currently uses a
system to store information about all 'currently' licensed drivers.

A licensed driver has the following info stored about them in a
record;
1. Given name(s) of the license holder.(not more than 128 char (may
have spaces)).
2. Surname of the license holder.(Not more then 128 same like above).
3. Driver license number.
4. The sex of the license holder.
5. The residental address of the license holder.(Not more then
128)same.
6. The registration number of the car the license holder drivers.(A
combination of char and numbers. The string must be six long.)

The current system allow users to add new license holders, modify
details about prexisting license holders and remove a license holder
by entering the license number.

Your job is to write a C++ program to replace the pre-existing system.
In doing so your program must;

1.Allow user to add new license holders to the system.
2.Allow user to remove the license holder from the system.
3. Allow the users to search on a license number, display and
potentially modify a matched record.

The program is an interactive and menu driven. A user can choose from
a set of options to perform a particular action. It also to has
persistent storage.Each license holder has one record in the system.
Records a fixed lenght, therefore the C++ type string cannot be used
in the implementation. The first time the program is run, there is no
data file in the file system. The file is a randoom access file used
to store a collection of records about liccense holders. The name of
this file is data.dat.

If the file already exists when the program starts, you are to read
the all records from the file, into array of records. You can assume
the maximum size of the array is 500. That is at any given time, your
system can hold a maximum of 500 license holders.

During runtime a user may add new license records.When a user adds a
new record, the program prompt the user to enter all details relevent
to the record. The record is inserted into the first available slot in
the array of records and written to the file immediately at the
correseponding record location. If there are no available records an
error is to be printed.

When a user removes a record, all elements of the record are cleared
and the record is marked as available. The corresponding record in the
file is then marked available.

Users can search/dispaly/modify a record. The search key is the
license number. If there is a record with the license number matching
the specified key, the record is displayed and the user given the
option of modifying the record. A user can search for a record and
display it without performing any modifications.

Your program should perform the appropriate checks to ensure valid
input at ALL time.
 
M

Matthew Burgess

Your job is to write a C++ program to replace the pre-existing system.
^^^^

When you have a specific problem with *your* program then post the
smallest relevant snippet of compilable code that you're having problems
with, along with the input, expected output and actual output you're
getting. We don't do homework here!

Regards,

Matt.
 
O

osmium

titi said:
The road and traffic authority for a small country currently uses a
system to store information about all 'currently' licensed drivers.
<snip>

This is going to take some time. I think a common mistake of beginners is
trying to do it "right" in the first attempt. This results in a lot of
typing, a lot of syntax errors, and a lot of fussing over details of things
that eventually get thrown away; with the result of wasting huge amounts of
time. (For example the warning about checking for valid data.) I would
start with only a minimal subset of data fields. Last name, simple one part
name such as Smith (as distinct from von Neuman) and license number might
be enough. BTW the thing about the old existing program seems to be mainly
noise to confuse you. Get the simple thing working to establish confidence
that the paths and methods will work, then start fleshing it out with
details. Note that a surname can change when a woman marries. I see a
menu, a class to hold the data and an ordinary array of these classes in
*main*. Note that C++ often defaults to do the opposite of what you expect
WRT white space.

This program is going to be 90% bulk and 10% useful and interesting "stuff".
 
J

John Harrison

osmium said:
<snip>

This is going to take some time. I think a common mistake of beginners is
trying to do it "right" in the first attempt. This results in a lot of
typing, a lot of syntax errors, and a lot of fussing over details of things
that eventually get thrown away; with the result of wasting huge amounts of
time.

It's no use, no only do newbies always make this mistake, they never, ever
listen to anyone who tells them to do different. At least that's my
experience from this newsgroup.

john
 
T

Thomas Matthews

titi said:

Since your a newbie and this is to demonstrate simple C++,
I will show you how using advanced C++ techniques.
DO YOUR OWN HOMEWORK.

The road and traffic authority for a small country currently uses a
system to store information about all 'currently' licensed drivers.

A licensed driver has the following info stored about them in a
record;

The above sentence is a clue that some information will always
be represented together as a unit. In C++ we would place that
in a structure or class. Search the index of your text book
for "struct" and "class". Learn the differences between the
two.

1. Given name(s) of the license holder.(not more than 128 char (may
have spaces)).

In the above sentence, the keywords "name", "char" and "spaces"
indicates you are using a text variable. The "not more than 128
char" implies a maximum length of text. Your options are:
array of 128 chars.
pointer to a char
std::string.
I choose the std::string type since it is easy to use. Your
mileage may differ.

The above sentence is decribing a unit of information in the
structure, often called a "field".

2. Surname of the license holder.(Not more then 128 same like above).

The keyword "Surname" indicates a text variable. See above.

3. Driver license number.

Hmm, tricky. The "number" implies either an integer or a
floating point variable. Typically, driver license numbers
are unsigned integer. However, if the "numbers" contain
"-" (dashes), periods, or spaces, they may better be represented
as a text field. Your choice here.

I'll choice text which implies std::string.

4. The sex of the license holder.

Another field with possibilities. The sex or gender of
a person is either male or female. This can be represented
as:
bool (let male == true, female == false or vice-versa).
integer (ex. 1 == male, 2 == female).
char ('m' == male, 'f' = female)
enumeration (enum Gender {MALE, FEMALE};)
class; (search the web for "class" and "enumeration")
I'll choose enumeration: enum Gender {MALE, FEMALE};


5. The residental address of the license holder.(Not more then
128)same.

Addresses are ususally represented as text fields.
I'll choose std::string.

6. The registration number of the car the license holder drivers.(A
combination of char and numbers. The string must be six long.)

In requirements, the term "string" denotes a text field.
Here the requirement says that there must be 6 chars in each
field. One could interpret this as "at least 6", in which
a std::string could be used as long as the length is 6 or less.


In summary:
/* 4 */ enum Gender {MALE, FEMALE};
/* 6 */ const unsigned int MAX_REGISTRATION_LENGTH = 6;

class License_Info
{
/* 1 */ std::string given_name;
/* 2 */ std::string surname;
/* 3 */ std::string id; // identifier or number
/* 4 */ Gender sex;
/* 5 */ std::string resident_addr;
/* 6 */ std::string registration;
};

The numbers in C style comments refer to the requirement
number in the assignment.

The current system allow users to add new license holders, modify
details about prexisting license holders and remove a license holder
by entering the license number.

The above sentence lists the functionalities of the program:
add new license holder
modify existing license holder's information
remove a license holder

_You_ will have to create a user-interface (often called a menu)
to allow the user to select one of the above actions, and perhaps
an extra one to exit or stop the program.

Your job is to write a C++ program to replace the pre-existing system.
In doing so your program must;

This is not really clear given the requirements.
Were you given an existing program to modify?
Or are the next set of function to be added to your new program?
I would clarify this with the instructor or the one who handed
out the requirements. ALWAYS CLARIFY ANY AMBIGUITIES IN
REQUIRMENTS BEFORE CODING.

1.Allow user to add new license holders to the system.
2.Allow user to remove the license holder from the system.
3. Allow the users to search on a license number, display and
potentially modify a matched record.

The program is an interactive and menu driven. A user can choose from
a set of options to perform a particular action. It also to has
persistent storage.Each license holder has one record in the system.
Records a fixed lenght, therefore the C++ type string cannot be used
in the implementation.

Bummer, can't use std::string because of the restriction above.
Oh well, just use fixed length arrays of char.
The first time the program is run, there is no
data file in the file system. The file is a randoom access file used
to store a collection of records about liccense holders. The name of
this file is data.dat.

If the file already exists when the program starts, you are to read
the all records from the file, into array of records. You can assume
the maximum size of the array is 500. That is at any given time, your
system can hold a maximum of 500 license holders.

During runtime a user may add new license records.When a user adds a
new record, the program prompt the user to enter all details relevent
to the record. The record is inserted into the first available slot in
the array of records and written to the file immediately at the
correseponding record location. If there are no available records an
error is to be printed.

When a user removes a record, all elements of the record are cleared
and the record is marked as available. The corresponding record in the
file is then marked available.

Users can search/dispaly/modify a record. The search key is the
license number. If there is a record with the license number matching
the specified key, the record is displayed and the user given the
option of modifying the record. A user can search for a record and
display it without performing any modifications.

Your program should perform the appropriate checks to ensure valid
input at ALL time.

So, what is your issue with the assignment?
If there are any parts you don't understand, don't hesitate
clearifying them with your instructor. I have some instructors
where you need to get the clarifications in writing and notorized.
That way, when he/she changes his/her mind, you have proof.

Sorry, but I don't have the time now to write your program for
free. If you pay me, then I will write it for you.
My terms are $200.00 USD, payed in advance. Since you don't want
to write it, I'll assume you want me to deliver it too. So I
will need your instructor's email address and postal address to.
Many instructors require hard-copy in addition to an electronic
version.

Please let me know soon, as I have many current uses for the money.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 
M

Mike Wahler

titi said:

The below is not a question, but apparently simply a
reproduction of your assignment.

Go ahead and try to do it (break it down into small pieces,
then you won't be overwhelmed).

I've inserted a few general remarks below.
The road and traffic authority for a small country currently uses a
system to store information about all 'currently' licensed drivers.

A licensed driver has the following info stored about them in a
record;
1. Given name(s) of the license holder.(not more than 128 char (may
have spaces)).
2. Surname of the license holder.(Not more then 128 same like above).
3. Driver license number.
4. The sex of the license holder.
5. The residental address of the license holder.(Not more then
128)same.
6. The registration number of the car the license holder drivers.(A
combination of char and numbers. The string must be six long.)

Hmm, I own four automobiles, and drive each at various times.
I wonder how that's supposed to be handled ? :)
The current system allow users to add new license holders, modify
details about prexisting license holders and remove a license holder
by entering the license number.

Your job is to write a C++ program to replace the pre-existing system.
In doing so your program must;

1.Allow user to add new license holders to the system.
2.Allow user to remove the license holder from the system.
3. Allow the users to search on a license number, display and
potentially modify a matched record.

The program is an interactive and menu driven. A user can choose from
a set of options to perform a particular action. It also to has
persistent storage.Each license holder has one record in the system.
Records a fixed lenght, therefore the C++ type string cannot be used
in the implementation.


I see nothing in this specification that would prevent using the
std::string type to represent textual data.
The first time the program is run, there is no
data file in the file system. The file is a randoom access file used
to store a collection of records about liccense holders. The name of
this file is data.dat.

If the file already exists when the program starts, you are to read
the all records from the file, into array of records.

The preferred "C++ way" of storing such 'collections' of same-type
objects is to use a container (e.g. std::vector) rather than an
array. But I suppose you should go ahead and use an array, if
it's required by the assignment.

You can assume
the maximum size of the array is 500. That is at any given time, your
system can hold a maximum of 500 license holders.

Note: using a container would eliminate the need for such an
arbitrary restriction. (Yes, an array could be dynamically
allocated, and expanded as needed, but that gets to be a mess
rather quickly.) Containers Are Cool. :)
During runtime a user may add new license records.When a user adds a
new record, the program prompt the user to enter all details relevent
to the record. The record is inserted into the first available slot in
the array of records and written to the file immediately at the
correseponding record location. If there are no available records an
error is to be printed.

When a user removes a record, all elements of the record are cleared
and the record is marked as available. The corresponding record in the
file is then marked available.

Users can search/dispaly/modify a record. The search key is the
license number.

Hmmm, no requirment or check that a driver's license number be
unique?
If there is a record with the license number matching
the specified key, the record is displayed and the user given the
option of modifying the record. A user can search for a record and
display it without performing any modifications.

Your program should perform the appropriate checks to ensure valid
input at ALL time.

As should any program. Validating input is very often a large
part of a program's code.

-Mike
 
O

osmium

Mike said:
Hmm, I own four automobiles, and drive each at various times.
I wonder how that's supposed to be handled ? :)

There are very few countries that have only 500 citizens. So might this be
for an imaginary country, perhaps????
Records a fixed [length], therefore the C++ type string cannot be used
in the implementation.
I see nothing in this specification that would prevent using the
std::string type to represent textual data.

I see *HUGE* problems in using a C++ string! You can not do random access
to a file with variable length records. That is *very clearly* the intent
of the problem!
 
M

Mike Wahler

osmium said:
Mike said:
Hmm, I own four automobiles, and drive each at various times.
I wonder how that's supposed to be handled ? :)

There are very few countries that have only 500 citizens. So might this be
for an imaginary country, perhaps????
Records a fixed [length], therefore the C++ type string cannot be used
in the implementation.
I see nothing in this specification that would prevent using the
std::string type to represent textual data.

I see *HUGE* problems in using a C++ string!

I don't, unless a bit of thought is a 'huge problem' :)
You can not do random access
to a file with variable length records.

Using std::string doesn't require variable length records.
That is *very clearly* the intent
of the problem!

const std::streamsize name_width(20);
std::string name("Mike");
std::fstream fs("filename");
fs << std::left << std::setw(name_width) << name;

You were saying? :)

-Mike
P.S. Alternatively, if using fstream::read / fstream::write,
one can build the character buffer by e.g. << into a stringstream
and passing its 'str().c_str()' member, or sprintf() into the
buffer directly, using an appropriate length specifier in the
format string.
 
O

osmium

Mike said:
osmium said:
Mike said:
Hmm, I own four automobiles, and drive each at various times.
I wonder how that's supposed to be handled ? :)

There are very few countries that have only 500 citizens. So might this be
for an imaginary country, perhaps????
Records a fixed [length], therefore the C++ type string cannot be used
in the implementation.
I see nothing in this specification that would prevent using the
std::string type to represent textual data.

I see *HUGE* problems in using a C++ string!

I don't, unless a bit of thought is a 'huge problem' :)
You can not do random access
to a file with variable length records.

Using std::string doesn't require variable length records.
That is *very clearly* the intent
of the problem!

const std::streamsize name_width(20);
std::string name("Mike");
std::fstream fs("filename");
fs << std::left << std::setw(name_width) << name;

You were saying? :)

-Mike
P.S. Alternatively, if using fstream::read / fstream::write,
one can build the character buffer by e.g. << into a stringstream
and passing its 'str().c_str()' member, or sprintf() into the
buffer directly, using an appropriate length specifier in the
format string.

You obviously have a fondness for complexity that I do not share. Tools are
there to *help* you. If you have to apply a work-around, pick up another
tool instead of applying a patch.
 
M

Mike Wahler

osmium said:
Mike said:
osmium said:
Mike Wahler writes:

Hmm, I own four automobiles, and drive each at various times.
I wonder how that's supposed to be handled ? :)

There are very few countries that have only 500 citizens. So might
this
be
for an imaginary country, perhaps????

Records a fixed [length], therefore the C++ type string cannot be used
in the implementation.

I see nothing in this specification that would prevent using the
std::string type to represent textual data.

I see *HUGE* problems in using a C++ string!

I don't, unless a bit of thought is a 'huge problem' :)
You can not do random access
to a file with variable length records.

Using std::string doesn't require variable length records.
That is *very clearly* the intent
of the problem!

const std::streamsize name_width(20);
std::string name("Mike");
std::fstream fs("filename");
fs << std::left << std::setw(name_width) << name;

You were saying? :)

-Mike
P.S. Alternatively, if using fstream::read / fstream::write,
one can build the character buffer by e.g. << into a stringstream
and passing its 'str().c_str()' member, or sprintf() into the
buffer directly, using an appropriate length specifier in the
format string.

You obviously have a fondness for complexity that I do not share. Tools are
there to *help* you. If you have to apply a work-around, pick up another
tool instead of applying a patch.

I would not call it a 'patch'.

Exploit std::string's ease of use and robustness everywhere
in the code, apply a single 'setw()' manipulator for persistence
in a fixed-length-record file.

Mucking around with arrays when 'std::string' is so obviously superior,
is what I'd call a 'patch' in C++.

But I suppose we all have our own philosophies and opinions ...

-Mike
 
J

Jerry Coffin

[ ... ]
I see *HUGE* problems in using a C++ string! You can not do random access
to a file with variable length records.
Nonsense!

That is *very clearly* the intent of the problem!

The original statement of the problem does specifically say that records
are to be of a fixed length, and "therefore the C++ string type can't be
used."

If student does succeed in getting somebody to solve his homework for
him, he will apparently have done his homework just as well as (if not
better than) the ignorant boob who's teaching this nonsense.
 
J

Jonathan Turkanis

titi said:
Question

The road and traffic authority for a small country currently uses a
system to store information about all 'currently' licensed drivers.
Your program should perform the appropriate checks to ensure valid
input at ALL time.

Everyone assumes this is a homework assignment. I'll give you the
benfit of the doubt and assume you have read the FAQ and would not ask
other to do your assignment for you.

I conclude that you have been hired by a very small impoverished
country which cannot afford an experienced programmer. Which country
are you working for? Be sure they pay you in advance!

Jonathan
 
O

osmium

Jerry Coffin writes:

[Osmium writes:]
[ ... ]
I see *HUGE* problems in using a C++ string! You can not do random access
to a file with variable length records.
Nonsense!

That is *very clearly* the intent of the problem!

The original statement of the problem does specifically say that records
are to be of a fixed length, and "therefore the C++ string type can't be
used."

If student does succeed in getting somebody to solve his homework for
him, he will apparently have done his homework just as well as (if not
better than) the ignorant boob who's teaching this nonsense.

I agree that the exercise could have been worded more elegantly. But how
many of us can write a perfect document of that length? You are not doing
the student any favor by making a post such as this. When there are two
sentences and then a blanket "nonsense" it is hard for a novice to figure
out exactly *what* is nonsense. You can not (or at the very least should
not) do random access to a file with variable length records. That is not
nonsense. And the exercise does explicitly state that it is a random access
file. (I hadn't really noted that when I made my earlier post, I deduced it
from the content.) I assume you knew what the instructor meant, why
purposely misunderstand him and then call him an ignorant boob, besides?

To the OP: the instructor does not mean that you can't converse with the
user via the C++ string, he means you should not save *that C++ string* to a
file. Or a C string either, for that matter. The records on the external
medium must be fixed length. Strictly speaking, he was not entitled to use
the word "therefore".

I would replace this:
Records [are] fixed [length], therefore the C++ type string cannot be used
in the implementation

with this:
Records are fixed length on the external medium. Thus you should not
directly store variable length fields, such as C or C++ strings, in the
file.
 
C

Claudio Puviani

osmium said:
You can not (or at the very least should not) do random access to a
file with variable length records.

Hogwash! Random access on variable-length records has existed since the early
days of computing, continues to this day, and is taught in the very first data
file management classes in any reputable university. All you need is an index
that gives you the start of the record and you can seek to it and retrieve it.

Here's a naively implemented snippet (without noisy error-checking):

int VRL::readRecord(const KEY_T & key, void * result, long maxLen)
{
long bytePos = getBytePos(key);

if (0 > bytePos) {
return -1;
}

fseek(m_f, bytePos, SEEK_SET);

long recLen;

fread(&recLen, sizeof(recLen), 1, m_f);

fread(result, min(recLen, maxLen), 1, m_f);

return 0;
}

Please don't assert that something is possible or impossible unless you
understand the field on which you're commenting.

Claudio Puviani
 
J

Jerry Coffin

[ ... ]
I agree that the exercise could have been worded more elegantly. But how
many of us can write a perfect document of that length? You are not doing
the student any favor by making a post such as this. When there are two
sentences and then a blanket "nonsense" it is hard for a novice to figure
out exactly *what* is nonsense. You can not (or at the very least should
not) do random access to a file with variable length records.

This is what is nonsense -- you can, and many people DO use random
access on files with variable length records on an extremely regular
basis. Saying otherwise is nothing short of pure, unadulterated
nonsense.
That is not nonsense.

Repeating the same nonsense won't change it into something else. Look
at any decent database and you'll find that 1) it will support variable
length records, and 2) it will be able to do random access on those
records.

This isn't any sort of magic -- it's the simple result of a perfectly
normal thing called an index. It works pretty much the way an index in
a book does: you look something up in the index, and it tells you were
that data resides. You then do a seek directly to that point (i.e.
random access).
And the exercise does explicitly state that it is a random access
file. (I hadn't really noted that when I made my earlier post, I deduced it
from the content.) I assume you knew what the instructor meant, why
purposely misunderstand him and then call him an ignorant boob, besides?

Because somebody teaching a course in programming who doesn't know that
strings can be written as fixed-width fields and also doesn't know about
how to index a file is clearly ignorant should be restricted to teaching
small children how to tie their shoes, or some other subject of which he
has at least some grasp of the most basic facts.
with this:
Records are fixed length on the external medium. Thus you should not
directly store variable length fields, such as C or C++ strings, in the
file.

This is still pure nonsense. It still ignores the possibilities of
indexing and/or writing a string out in a fixed-width field. If you
want to say "variable-length records are beyond what we're covering
right now", so be it.

At least IMO, simplifying a problem to the point that it's approachable
is perfectly reasonable. Lying is a drastically different story.
 
G

Gary

Claudio Puviani said:
Hogwash! Random access on variable-length records has existed since the early
days of computing, continues to this day, and is taught in the very first data
file management classes in any reputable university. All you need is an index
that gives you the start of the record and you can seek to it and retrieve it.

Here's a naively implemented snippet (without noisy error-checking):

int VRL::readRecord(const KEY_T & key, void * result, long maxLen)
{
long bytePos = getBytePos(key);

if (0 > bytePos) {
return -1;
}

fseek(m_f, bytePos, SEEK_SET);

long recLen;

fread(&recLen, sizeof(recLen), 1, m_f);

fread(result, min(recLen, maxLen), 1, m_f);

return 0;
}

Please don't assert that something is possible or impossible unless you
understand the field on which you're commenting.

Your reply seems a little harsh to me.

The general usage of the term "random access" for files usually means the
direct access of records, usually by relative record number. Since the
location of a logical record may include deblocking andcalculation of track,
sector location, it is done by having fixed length records and calculating
the track, sector location, reading the block, and locating the record
within the block.

The use of an index for each record in order to seek to the record's
starting location is not usually called "random access." Rather, it is an
indexed file.
Consider the early IBM implementations: BDAM (basic direct access method) is
a "random access" method. ISAM (Indexed sequential access method) uses the
indexed file technique.

It would be better to identify the fact that the use of "random access" has
unclear meaning and should be clarified by using some different term
depending on what was meant. I'd have said direct access, myself (any
program that randomly accesses records won't be all that useful, except
possibly for statistical applications).

Would you jump on me if I said arrays cannot be extended by adding elements
to them? (You can allocate a new, larger array, copy the elements to that
and it has been "extended." Followed by: "Please don't assert that something
is possible or impossible unless you understand the field on which you're
commenting.")
 
C

Claudio Puviani

"osmium"> You can not (or at the very least should not) do random access
"osmium"> to a file with variable length records.
"Claudio Puviani"> Hogwash!
"Gary> Your reply seems a little harsh to me."

I'm open to a more politically-correct adjective, but I stand by my statement.
The general usage of the term "random access" for files usually means the
direct access of records, usually by relative record number.

That's a seriously incomplete definition. The term "random access" describes the
ability to jump to any part of the file, as opposed to "sequential access" which
forces you to read through unrelated data before accessing what you need.
Whether the byte position or record number is derived from an absolute value, a
hash, an index lookup, or any other mechanism is completely irrelevant.
It would be better to identify the fact that the use of "random access" has
unclear meaning and should be clarified by using some different term
depending on what was meant. I'd have said direct access, myself

You're talking about two different things. "Direct/indirect access" and
"random/sequential access" are orthogonal concepts.
Would you jump on me if I said arrays cannot be extended by adding elements
to them? (You can allocate a new, larger array, copy the elements to that
and it has been "extended." Followed by: "Please don't assert that something
is possible or impossible unless you understand the field on which you're
commenting.")

That's quite the non sequitur. Ok, I'll play along. No I won't jump on you for
saying that "2+2=4"despite the fact that I jumped on someone for asserting that
the earth is flat.

Claudio Puviani
 
O

osmium

Claudio Puviani said:
"osmium"> You can not (or at the very least should not) do random access
"osmium"> to a file with variable length records.
"Claudio Puviani"> Hogwash!
"Gary> Your reply seems a little harsh to me."

I'm open to a more politically-correct adjective, but I stand by my statement.

That's a seriously incomplete definition. The term "random access" describes the
ability to jump to any part of the file, as opposed to "sequential access" which
forces you to read through unrelated data before accessing what you need.
Whether the byte position or record number is derived from an absolute value, a
hash, an index lookup, or any other mechanism is completely irrelevant.


You're talking about two different things. "Direct/indirect access" and
"random/sequential access" are orthogonal concepts.
Claudio Puviani
If the instructor had meant the use of an index, the following would not
have made any sense:
When a user removes a record, all elements of the record are cleared
and the record is marked as available. The corresponding record in the
file is then marked available.

If he was talking about an indexed file he would simply have said "Remove
the entry from the index". This paragraph makes his intent crystal clear,
regardless of the fact that he may have used an imperfectly chosen word
here or there. The elements are munged to provide
privacy/security/whatever.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top