Thread: array of strings

  1. #1
    Registered User
    Join Date
    Jan 2002

    Post array of strings

    -Can anyone give an example of a program that fills an array with words or names?
    and if anyone can use the AP class subsets that would be great. thanks

  2. #2
    Seņor Member
    Join Date
    Jan 2002
    I'm not to sure about what you are asking, but I'll give it a shot.


    void main ()
    apvector<apstring>array (4,0);

    Something like that? Or do you mean make up it's own words?

  3. #3
    using apstring it would look something like this...

    your #includes up here...

    const int MAX_SIZE = 10; // the max # of apstrings in the array
    typedef apstring Array_Name[MAX_SIZE]; // the array Array_Name here

    int main()

    // loop to fill each string in the array
    for (int x=0; x<MAX_SIZE; x++)
    Array_Name[x] = "something"; // fills each string in the array with "something"

    return 0;
    } // main

    I think thats what you were asking. If not, oh well. If you wanted to ask the user what they would like to put in the array just throw in some cout/cin lines inside the loop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. intializing an array of strings
    By doubty in forum C Programming
    Replies: 4
    Last Post: 06-19-2009, 12:59 PM
  2. Replies: 1
    Last Post: 03-19-2009, 10:56 AM
  3. Build an array of strings dynamically
    By Nazgulled in forum C Programming
    Replies: 29
    Last Post: 04-07-2007, 09:35 PM
  4. Array of strings in C
    By szill in forum C Programming
    Replies: 10
    Last Post: 02-22-2005, 05:03 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM