C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 11th, 2005, 08:26 AM
Rezanin Rezanin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Birmingham, UK
Posts: 2 Rezanin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Rezanin
Question OOP Linked List, Help Needed!

Hey all devheads,

i have this one piece of coursework which is really annoying me, i was hoping someone on this board could give me a push in the right direction. all help would be much appreciated.

I have to convert a structured program to a object oriented program using encapsulation and inheritance. I have a general jist of OOP, but just cant seem to get it together to do the coding required. I've been told it can only hold member functions (except for the main function which should only contain the code to create the first object), and it cant use global variables. I've attached the coding so you can freely browse through it.

I hope someone out there can help me with this, hopefully once i get to grips with C++ i can start helping the next lot of newbies!

Cheers, Rezanin
Attached Files
File Type: zip task2.zip (3.2 KB, 334 views)

Reply With Quote
  #2  
Old January 11th, 2005, 01:48 PM
Rezanin Rezanin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Birmingham, UK
Posts: 2 Rezanin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Rezanin
I've made some progress since my last post. Ive created 3 main objects, an data storage class, a nodal pointer class, and a linked list class. I've progressed alot further in the programming and i'm starting to get to grips with it, but i'm afraid im still having problems with the program.

I've compiled it with Visual C++ 6.0 standard edition and there were no errors or warnings. When i run the program operational amplifiers are added fine but then when going to display them the program crashes. i've tried to search and ammend this error but cant seem to be able to do it.

Any help would be great as time is running out for me (not in a bells of doom ringing kind of way, but u get what i mean).

Thanks Rezanin

The coding follows...

[edit] i've attached the source code file instead as this post doesnt seem to like tabulated pastes [/edit]
Attached Files
File Type: zip cwk2c.zip (1.4 KB, 226 views)

Reply With Quote
  #3  
Old January 12th, 2005, 04:00 PM
marmo marmo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 37 marmo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 15 m 20 sec
Reputation Power: 5
You were setting the current pointer to next before you displayed it. Do the assignment at the bottom of the while loop like so.

Code:
 void OpAmpsLists::DisplayList()
 {
 	ListNodePtr Current;
 	OpAmps ShowAmp;
 	
 	Current = Front->Next;
 
 	while (Current != NULL)
 	{
 		ShowAmp = Current->OpAmp;
 		ShowAmp.ShowValues();
 		Current = Current->Next;
 	}
 }
 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > OOP Linked List, Help Needed!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT