Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-14-2003, 08:59 AM   #1 (permalink)
zergmuncher
Registered User
 
zergmuncher's Avatar
 
Join Date: May 2003
Location: CA
Posts: 12
zergmuncher is on a distinguished road
Send a message via AIM to zergmuncher
vector of vectors

I'm making a program which is a guitar chord calculator, to do this, I need to make a vector of vectors, (we use a class called apvector, so don't get like...confused). How do I declare this? Right now, I have:

apvector<apvector<int> jerry(5)> harry(5);

and it won't work. Any idea? if it's my apvector include file, where can I get the vector include file...and how do I call the function (IE cout<< harry[3].jerry[2] or something like that? Ok, it's the end of the period, I have to go.
zergmuncher is offline   Reply With Quote
Old 05-14-2003, 11:38 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
i'm not much help, but here's one my friend programmed in flash =)

http://lessons4guitar.com/Chords.swf
__________________
Mike
sde is offline   Reply With Quote
Old 05-14-2003, 11:58 AM   #3 (permalink)
alpha
Regular Contributor
 
Join Date: Feb 2003
Posts: 120
alpha is on a distinguished road
Send a message via AIM to alpha
try:

apvector<apvector<int> > harry(5);
alpha is offline   Reply With Quote
Old 05-14-2003, 02:30 PM   #4 (permalink)
zergmuncher
Registered User
 
zergmuncher's Avatar
 
Join Date: May 2003
Location: CA
Posts: 12
zergmuncher is on a distinguished road
Send a message via AIM to zergmuncher
can I have the inner vector have a name? Or would that require a struct? And how do I call it? Either harry[3][2] or
harry[3].jerry[2] (<-- note the dot). And I'll check out the flash one, thanks, all you guys!!:rock:
zergmuncher is offline   Reply With Quote
Old 05-14-2003, 11:24 PM   #5 (permalink)
Unicorn
Registered User
 
Unicorn's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 11
Unicorn is on a distinguished road
Quote:
if it's my apvector include file, where can I get the vector include file...
It's a standard class, just #include <vector>

Quote:
can I have the inner vector have a name?
Nope, it's a template argument.

Quote:
Or would that require a struct?
If you want it to have a name, indeed you'll need a struct with just one member (the vector<int> named jerry). Harry would then be a vector of those structs.

Quote:
And how do I call it? Either harry[3][2]
That's the one. Don't forget to allocate enough space in your inner vectors as well:

Code:
apvector<apvector<int> > Harry (5);

Harry[0].resize (20);
Harry[1].resize (12);
(etc.)
Unicorn is offline   Reply With Quote
Old 05-15-2003, 08:15 AM   #6 (permalink)
zergmuncher
Registered User
 
zergmuncher's Avatar
 
Join Date: May 2003
Location: CA
Posts: 12
zergmuncher is on a distinguished road
Send a message via AIM to zergmuncher
wow, guys, thank you so much. I really appreciate that.:p
zergmuncher is offline   Reply With Quote
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 12:10 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting