Array of strings

This is a discussion on Array of strings within the C++ Programming forums, part of the General Programming Boards category; Okay so after getting my bubble sort algorithm to work I've decided to code a program to put words in ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    106

    Array of strings

    Okay so after getting my bubble sort algorithm to work I've decided to code a program to put words in alphabetical order. My problem is I want to make an array of string and then access a certain letter in the string but im not sure how to do that...

    I know if you want to see say the first character you would do this:
    Code:
    string sample;
    sample = bob;
    cout<< sample[0];
    so it would print out b

    but my problem is having the string as part of an array and wanting to access a ceratin charactar of an index of an array so say you wanted to see what was the first character of the fifth string in an array how would you go about that...

  2. #2
    Registered User
    Join Date
    Jul 2010
    Posts
    26
    you wanted to see what was the first character of the fifth string in an array how would you go about that...
    Like this:
    Code:
    cout<<array[4][0];

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. matching of names in 2d array of strings...
    By roaan in forum C Programming
    Replies: 6
    Last Post: 07-25-2009, 09:59 AM
  2. intializing an array of strings
    By doubty in forum C Programming
    Replies: 4
    Last Post: 06-19-2009, 12:59 PM
  3. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  4. Build an array of strings dynamically
    By Nazgulled in forum C Programming
    Replies: 29
    Last Post: 04-07-2007, 09:35 PM
  5. Array of strings in C
    By szill in forum C Programming
    Replies: 10
    Last Post: 02-22-2005, 04:03 PM

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