GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rating: Thread Rating: 3 votes, 5.00 average.
  #1  
Old 24-Apr-2004, 13:21
anignna anignna is offline
New Member
 
Join Date: Mar 2004
Location: Chicago
Posts: 8
anignna is on a distinguished road

Help with project.


Hi.
My CS professor has just posted out final project and i need some help understanding exactly what he wants us to do. The project can be acsessed at http://www.cs.iit.edu/~cs106/Project/ProjectDescr.html. I just want people to give me input on what i'm supposed to do, what type of algorithm would be best suited for it, not do it for me. I know the description is kind of lenghty but i need help and will greatly appreciate any input. I can't figure out how to even start writing code for it.

Thanks
  #2  
Old 25-Apr-2004, 08:08
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Hi anignna.

First of all that is a descriptive and complete assignment description. It is well organized and easy to follow. I like seeing U profs put in as much time into their classes as students.

Everyone, probably has different approaches to starting a programming project and each project may even be started differently. In this case, I think I would start just defining the three classes that will be necessary according to item #6. You need an order database, an order item and a transaction item.

Each of these should be defined in a seperate header file and implemented in a seperate C file. I would start with the header files and try to keep your variable names clear and add simple valid comments as you go.

Then start with the implementation and just take it one concept at a time. I would test often through this process, making sure that data is added properly, etc.

After the backend is significantly complete you can start to add the spit and polish.

This is just a suggestion and others may have other equally valid suggestions. What I wouldn't do is try to sit down and try to write the whole thing or a major portion of it and then test it. I think validation will be easier on each segment. I also think it is very easy to get lost in your own code if you don't break it down.

HTH,
d
  #3  
Old 25-Apr-2004, 20:11
anignna anignna is offline
New Member
 
Join Date: Mar 2004
Location: Chicago
Posts: 8
anignna is on a distinguished road

Thx for your help


I've gotten a nice start on the project but i have a few questions to ask first.

For the transaction input file there will be multiple lines and a certain number of characters available to each item

i want to know how to input the lines ito a multidimensional array.

For example

123456789012345678901234567890

12345 = array.type
6789 = array.time
012= array.mealcode

Using a struct i plan to create an array with different types such as array.type, array.time and array.mealcode.
If the first 5 characters of the line are for type, the next four for time and then three for mealcode, how do you input them into thier resective arrays.

Also if a guest wants to check out how do you delete a row of values. Ex
you match the name of a guest to a name on the MD array and you want to delete all the values associated with the name, meaning also all the values in the row..

Thx in advance for your help
  #4  
Old 26-Apr-2004, 00:41
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
first thing, why do you format you file like this:

12345678901234567890123456789.

it would be easier to make spaces between your data. Then you can simply read the data and put into your array. Like this:

12345 6789 012 34567 8901 234 56789

Now, read the file and put into your array.
CPP / C++ / C Code:
file>>type>>time>>mealcode;
while (!file.eof())
{
file>>type>>time>>mealcode;
}

__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #5  
Old 26-Apr-2004, 00:51
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
For your work here, it would be better to use linked list or any other ADT you feel suitable. I am not sure you know how to implement a linked list,do you??

deleting an element in the array, lets say that you want to delete the array at index 3, while your array size is 10. You need to shift all the array element. What i mean is that you start shifting from array index 4 to 3, 5 to 4 and till the end , 9 to 8. and don't forget to reduce the size by one.

Well, looks like my explanation not really good enough.. jusk as i said, take a look at linked list.
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #6  
Old 26-Apr-2004, 02:57
tay's Avatar
tay tay is offline
Junior Member
 
Join Date: Jan 2004
Posts: 77
tay will become famous soon enough
Quote:
Originally Posted by Max Payne
For your work here, it would be better to use linked list or any other ADT you feel suitable. I am not sure you know how to implement a linked list,do you??

deleting an element in the array, lets say that you want to delete the array at index 3, while your array size is 10. You need to shift all the array element. What i mean is that you start shifting from array index 4 to 3, 5 to 4 and till the end , 9 to 8. and don't forget to reduce the size by one.

Well, looks like my explanation not really good enough.. jusk as i said, take a look at linked list.

hi Max Payne
i study link list and ADT before
i know how the link list and ADT work
but i not sure when shall i implement it
what is link list use for
can u explain for me
__________________
challenges are make life interesting,
overcome them is make life meaningful.
  #7  
Old 26-Apr-2004, 03:51
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
Quote:
Originally Posted by tay
hi Max Payne
i study link list and ADT before
i know how the link list and ADT work
but i not sure when shall i implement it
what is link list use for
can u explain for me

Hi tay,

linked list like other ADTs has its feature that we want to take advantage of in order to solve a problem. Linked list is one of the most simple yet useful ADT. Linked list is suitable for for any small problem to a very complex solution and look at the 3 features listed below:

1. The list can be traversed from start to end
2. Nodes can be added at the beginning and end .
3. Elements can be inserted at any point.

with this three feature, you should know when to use the linked list. As an example take a simple problem of records of students. The program should be able to add,delete and modify students records and the record should be sorted by the name of the student. This is a simple example where u want to use linked list.

Can you think of a way to do this without using linked list. Sure, but it would be messy even its so simple problem. With linked list, u can visualize your problem well and would give you a wider look into the solution.

Problem solving is a very important task for a programmer, not just writing a program would do any good. Finding a good solution and then program it according to your solution. ADT is one of the option for problem solving.

Please correct me if I'm wrong.
Regards.
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #8  
Old 26-Apr-2004, 08:40
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Quote:
Originally Posted by Max Payne
Linked list is one of the most simple yet useful ADT.

Exactly. I am a huge fan of linked lists. They are simply a variable sized container to hold a collection of like objects. My own implementation of linked lists can be found here with a little sample code that will store double numbers in the list as they are input. You can put in as few or as many numbers (within memory limitations) as you want and the list will always be the exactly correct size.

Once you start getting into large data sets or more database like functions, a linked list starts to become less efficient and a more complex structure becomes necessary.
  #9  
Old 26-Apr-2004, 08:52
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Quote:
Originally Posted by anignna
Using a struct i plan to create an array with different types such as array.type, array.time and array.mealcode.
If the first 5 characters of the line are for type, the next four for time and then three for mealcode, how do you input them into thier resective arrays.

You could use strncpy to split these out quite easily. If you had a full entry called row, you could do something like;
CPP / C++ / C Code:
strncpy(array.type,row,5);
strncpy(array.time,row[5],4);
strncpy(array.mealcode,row[9],3);

Quote:
Also if a guest wants to check out how do you delete a row of values. Ex
you match the name of a guest to a name on the MD array and you want to delete all the values associated with the name, meaning also all the values in the row..

As Max has already stated a Dynamic storage structure would really help out with this. (A built in linked list mechanism in your structure would be a good way to do this....)
  #10  
Old 26-Apr-2004, 13:20
tay's Avatar
tay tay is offline
Junior Member
 
Join Date: Jan 2004
Posts: 77
tay will become famous soon enough
Quote:
Originally Posted by Max Payne
1. The list can be traversed from start to end
2. Nodes can be added at the beginning and end .
3. Elements can be inserted at any point.

Regards.

i think the tree the is best way to implement
cause what link list can do or the feature that link list have
the tree also have it
but the link list not easy and not good in sorting and searching

but tree easy to add/any point node, traversed and some easy to sort and search

but tree harder implement than link list
but if u know well the tree it should be easy than link list
__________________
challenges are make life interesting,
overcome them is make life meaningful.
 
 

Recent GIDBlogWelcome to Baghdad by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 15:41
Project 2 BobbyDouglas C++ Forum 1 09-Sep-2003 21:02
Anyone need a PHP project done? geedubya15 New Member Introductions 2 25-Jun-2003 11:29
Grub's distributed web crawling project Good for webmasters running servers jrobbio Search Engine Optimization Forum 4 25-Jun-2003 08:48
GIDTopsites - my first PHP project! JdS GIDTopsites™ 14 15-Jul-2002 04:20

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:35.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.