Results 1 to 2 of 2

Thread: Strings in an Array

  1. #1

    Thread Starter
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734

    Strings in an Array

    OK I am very newb to C++, but am pretty good with PHP. Anyway What I want to do is have a multidimentional array.

    MyArray[0][0]="My string"
    MyArray[0][1]="My string2"
    MyArray[1][0]="The string"

    etc.

    How can I set this up in c++?

    Thanks

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Best is you use the string class:
    Code:
    #incude <string>
    using namespace std;
    
    string array[dim1][dim2];
    dim1 and dim2 must both be constant positive integers.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width