Tweak3D.Net
Save?
Not Registered Yet? Go here.
Join The Cult Tweakers Image Gallery Donate Search Today's Posts Mark Forums Read

Welcome to Tweak3D

This is an open forum about hardware and tech stuff. Sign-up here to join the discussion.

Reply
 
LinkBack Thread Tools Display Modes
Old 02-16-2006, 05:18 PM programming ? - c++   permalink #1
tex
jive turkey
 
Jan 2005
Last Seen: Yesterday
Location: ATX
Posts: 2,122 (#38tex was ranked #39 last month)
Thanked 0x in 0 posts

sorry to do this, i just realized i had left part of a project out i have due tomorrow, and this thing is giving me fits. compiler error message doesnt help either. whats wrong with it? palindrome is a class, works fine for everything else. << is overloaded, works fine if i use a constant vs an interator. size_type throws an error too. all the variables and stuff are defined right, its something with i and the vector::iterator shindig in the use of at(i). thanks

Code:
               for (vector<palindrome>::iterator i = pVector.begin(); i < pVector.end(); i++) {
                        cout << pVector.at(i);
                }

Truth! Hope! Change! Generalities! Policies? Stupidity. Obama 08.
tex is offline   Reply With Quote
Yesterday, 05:30 PM   #2
 
 


Google is online (hide)  
Old 02-16-2006, 06:18 PM   permalink #2
thadood's Avatar
thadood
I Am The Black Wizards
 
Jan 2005
Last Seen: Yesterday
Location: Horn Lake, MS
Posts: 3,310 (#21)
Thanked 2x in 2 posts

Using a class?

Write a function within it to display the information rather than trying to cout it every time.

Example:
Code:
               for (vector<palindrome>::iterator i = pVector.begin(); i < pVector.end(); i++) { 
                        pVector.print(i); 
                }

thadood is offline   Reply With Quote
Old 02-16-2006, 06:39 PM   permalink #3
MSP's Avatar
MSP
Globe Trekker
 
Jan 2005
Last Seen: Yesterday
Posts: 15,233 (#1)
Thanked 2x in 2 posts

I know jack shit about programming. In 7th grade I took a programming class at a local college and made a command decision - I'm not well suited to sitting and pounding out code all day. Hence I do hardware, networking, and project management.

MSP is offline   Reply With Quote
Old 02-16-2006, 07:05 PM   permalink #4
hans5849's Avatar
hans5849
Has Absolutely no life
 
Jan 2005
Last Seen: Yesterday
Location: The Gorge, WA
Posts: 6,452 (#3)
Thanked 0x in 0 posts

^We Ryans stick together.

Driving the bus to hell since 1984.
hans5849 is offline   Reply With Quote
Old 02-16-2006, 07:33 PM   permalink #5
tex
jive turkey
 
Jan 2005
Last Seen: Yesterday
Location: ATX
Posts: 2,122 (#38tex was ranked #39 last month)
Thanked 0x in 0 posts

Quote:
Originally Posted by thadood
Using a class?

Write a function within it to display the information rather than trying to cout it every time.

Example:
Code:
               for (vector<palindrome>::iterator i = pVector.begin(); i < pVector.end(); i++) { 
                        pVector.print(i); 
                }
yeah, i know how to do that, its my backup plan right now. im supposed to overload << tho. and theres a lot of other stuff i need at() for...

and i would imagine using << would be more proper than .print()
tex is offline   Reply With Quote
Old 02-16-2006, 07:35 PM   permalink #6
thadood's Avatar
thadood
I Am The Black Wizards
 
Jan 2005
Last Seen: Yesterday
Location: Horn Lake, MS
Posts: 3,310 (#21)
Thanked 2x in 2 posts

OOH, I get what you're doing now.

You can probably find how to do it using some code I wrote a while back: http://thadood.ath.cx/9.cpp
Let me know if it helps.
thadood is offline   Reply With Quote
Old 02-16-2006, 08:13 PM   permalink #7
tex
jive turkey
 
Jan 2005
Last Seen: Yesterday
Location: ATX
Posts: 2,122 (#38tex was ranked #39 last month)
Thanked 0x in 0 posts

lol thats not the problem. << IS overloaded properly. I can call it on specific elements and it works fine. the problem is with the iterators. if i replace .at(i) with .at(x) with x being any integer, it works fine. im screwing up with the iterator somehow...
tex is offline   Reply With Quote
Reply

Login to reply. Sign-up here.


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Programming and Design Links tweakmonkey Tech 1 01-27-2008 10:46 AM
TI Calculator Programming, Ahh the Memories Torx Off-Topic 11 07-24-2006 05:44 PM
Resume Help needed Please!!!!! Alpha Off-Topic 8 06-06-2006 05:16 PM
Supercars video, Programming tweakmonkey Status and Feedback 0 04-22-2006 05:49 PM
programming 8.0 UHF pro remote MatTMaN Off-Topic 6 03-06-2006 07:58 PM


All times are GMT -7. The time now is 02:33 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0
©Tweak3D.Net 1998-2008Ad Management by RedTyger