Thread: Wondering if this is possible

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    32

    Wondering if this is possible

    I just want to know if this is possible, i do not want someone to tell me how to do it.

    I am wondering if you can use vectors to store a series of information at a given time
    ex)(my homework which is y i just want to know if this is possible)
    adding a planet and its information to a vector, then using the push_back() feature to put that vector inside another vector
    (vector <double> planet_info() into vector <vector <double> > planet_list)
    where planet_info() looks like
    Code:
    double planet_info()
    {
       push_back(name(string));
       push_back(mass(string));
       push_back(radius(string));
       push_back(planet_type(string));
       push_back(surface_area(string));
       push_back(density(string));
       push_back(gravity(string));
    }
    where the push_back() feature calls the function to input the data
    Last edited by Creatlv3; 05-11-2010 at 11:55 PM. Reason: slight change to data input style

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    There's nothing stopping you from using a vector of vectors, or what looks to be more appropriate here would be a vector of structures.

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    32
    ok, like i said, i wanted to make sure that this idea would work before i spent several hours wasting my time just to find out that it doesn't work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just wondering.
    By Aliaks in forum C++ Programming
    Replies: 5
    Last Post: 06-12-2009, 09:48 PM
  2. just wondering
    By sreetvert83 in forum C++ Programming
    Replies: 3
    Last Post: 04-26-2003, 08:24 PM
  3. wondering about people here
    By moemen ahmed in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 07-08-2002, 09:33 PM
  4. Just wondering.
    By n3urai in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-20-2002, 08:11 PM
  5. wondering
    By xlordt in forum A Brief History of Cprogramming.com
    Replies: 35
    Last Post: 03-01-2002, 07:05 AM