Creating Arrays of Strings

This is a discussion on Creating Arrays of Strings within the C++ Programming forums, part of the General Programming Boards category; Well, I was wondering if it was possible, which i'm sure it is, to create an array of strings? If ...

  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,262
    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
    Portugal
    Posts
    7,438
    Wow! You are really helpful.

    So... can you please do my game for me?
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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,069
    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
    Portugal
    Posts
    7,438
    darn!
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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,262
    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, 08:37 AM
  2. Replies: 2
    Last Post: 02-23-2004, 05:34 AM
  3. creating dynamic arrays
    By Cnewb in forum C Programming
    Replies: 11
    Last Post: 12-01-2002, 05: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21