Thread: Creating Arrays of Strings

  1. #1
    Me
    Join Date
    Jul 2006
    Posts
    71

    Creating Arrays of Strings

    Well, I was wondering if it was possible, which i'm sure it is, to create an array of strings? If so please post the code needed to do so.

    Thanks.

  2. #2
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    try creating an array of strings as you would an array of ints, and tell us what you come back with.

  3. #3
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Code:
    #include <iostream>
    #include <string>
    
    int main()
    {
    
         string array_of_strings[] = "hello", "how", "are", "ye", "?" ;
    
         for (int i=0; i<5; i++)
         {
              cout << array_of_strings[i] << "  " ;
         }
    
    }
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Wow! You are really helpful.

    So... can you please do my game for me?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Mario F why don't you read the announcements instead of asking others to do your work for you!
    http://cboard.cprogramming.com/annou...t.php?f=3&a=39

    ...nyuck, nyuck, nyuck...
    Sent from my iPadŽ

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    darn!
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    I bet it's homework too!

  8. #8
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    [sarcasm]
    Well mario is in his 30's, so I'll bet that it's a homework assignment for his
    students and he's too lazy to come up with a sample solution for them!!!
    [/sarcasm]
    Last edited by Richie T; 07-25-2006 at 08:06 PM.
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  9. #9
    Registered User
    Join Date
    Oct 2005
    Posts
    82
    Quote Originally Posted by Mario F.
    Wow! You are really helpful.

    So... can you please do my game for me?
    LOL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. storing strings in arrays
    By smp in forum C Programming
    Replies: 6
    Last Post: 12-16-2008, 09:37 AM
  2. Replies: 2
    Last Post: 02-23-2004, 06:34 AM
  3. creating dynamic arrays
    By Cnewb in forum C Programming
    Replies: 11
    Last Post: 12-01-2002, 06:13 PM
  4. Creating Strings from other stuff
    By Manitoadlet in forum C++ Programming
    Replies: 7
    Last Post: 09-10-2002, 06:07 PM
  5. strings or character arrays
    By Shadow12345 in forum C++ Programming
    Replies: 2
    Last Post: 07-21-2002, 10:55 AM