473,789 Members | 2,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help me to solve this C++ problem

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.
Jul 22 '05
20 2689
"osmium" <r1********@com cast.net> wrote
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.


Marking records as available is an ancient, if inefficient, technique and can
perfectly coexist with the use of index files. The index files and record files
are often managed separately, with the latter using free lists, markers (less
efficient) or other allocation mechanism. Whether the record is cleared or not
is, again, completely independent of how you deallocate the block.

If you don't have books on the subject, I suggest you have a look at Faircom's
on-line documentation: http://www.faircom.com/support/mans.shtml#ctpman, but
please stop making incorrect blanket statements. There's no shame in not knowing
something, but you look extremely bad when you impart incorrect information on
people who are trying to learn.

Claudio Puviani
Jul 22 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1955
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the past 2 weeks now i give up and call for help. Please if anyone can gide me through i will be so grateful!! I have pasted my code below
28
3308
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
15
3360
by: Alfonso Morra | last post by:
Hi, I have some code from an example, that I want to retrofit into my project. The code from the example has the following line: SharedAppenderPtr myAppender( new RollingFileAppender("MyAppender")) I want to move this line of code to a constructor in a wrapper class, so that I can determine the appropriate Appender name during the object's
1
1537
by: Tito Brezovacki via .NET 247 | last post by:
Hi. The problem is very simple to describe, but tough to solve :( I have a printer that doesn't print on win98 using the usualprocedures (print() in C#) . I could barely get it to work on xpby the way. (the xpsp2b helped). Then I realized I could use a com port manipulation to send infothrough to it ! Of course, .net doesn't have what i need so ihad to use . Everything worked fine on XP but all hell broke on Win98. Irealized that the...
4
1143
by: Adrian | last post by:
This is off topic - however, I badly need to solve this problem. A program has been installed in Program Files of an W98 machine. Subsequently the program was removed from Program Files, not in the proper way though, it was just deleted. Trying to install a new version of the program, a message is returned to the effect that the program already exists, which it does not. Trying to remove the program with the the proper installer...
16
2820
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
21
2331
by: c | last post by:
Hi everybody. I'm working on converting a program wriiten on perl to C, and facing a problem with concatenate strings. Now here is a small program that descripe the problem, if you help me to solve in this small code, I can solve it on my own program...you don't want to have head-ache :-) So, the problem excatly is, I built an array..just like this one.
8
1577
by: Dhananjay | last post by:
hello everyone Do you have any information how to generate a tool using .net which is used to translate the web page contents to html format. Plz reply me asap Thanks in advance Dhananjay
8
1921
by: SanjaiGandhi | last post by:
Hi ...i am new to programing....pls help to overcome this program.. The Program is..: if a = 557..using for loop or while or dowhile ..we have to get the answer for 5+5+7..that is what ever numbers we entered to a..that should be added.. for eg if a = 34 the answe should be 7 that is 3+4 using % and / we can solve this problem..pls help me to get the problems
6
1790
by: Kyote | last post by:
I'm trying to make, what I thought, would be a simple application. This application will help me organize files I have a lot of, on my computer(ebooks, pictures, etc..). I'm currently dealing with over 25,000 files in a couple hundred directories. I'm currently trying to collect the list using this Try For Each foundfile As String In My.Computer.FileSystem.GetFiles(mySource,
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.