array of strings

This is a discussion on array of strings within the C++ Programming forums, part of the General Programming Boards category; Hello all! I am new to this website.I am weak in c++ and need yur help. here is my question. ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    1

    array of strings

    Hello all!
    I am new to this website.I am weak in c++ and need yur help.
    here is my question.

    1) Write a program to read an array of strings and print its contents backwards. For ex: the array of strings is
    Hello
    Programming
    World
    Then the program should print “World Programming Hello”

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    Can you
    - write a program that reads one string, and print it?
    - write a program which reads an array of strings, and prints it forwards?

    If you can do these things, then that goes a long way to making us think you're attempting your own homework, and not just dumping it on a forum for someone else to do.

    If you can't do these simple steps, then we have some other things which need to be explained before we get to the complicated bit of printing in reverse.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User bobknows's Avatar
    Join Date
    Jan 2011
    Location
    SD
    Posts
    87
    just cin the strings and then cout them in a for loop with a decreasing integer, you will also need a way to cin them without ignoring spaces, i recomend multiple char arrays and getline
    Last edited by bobknows; 02-20-2011 at 05:51 PM. Reason: lotsa speling erorz ;P

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    No char arrays! Period.
    And let's let the OP show some effort first.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Build an array of strings dynamically
    By Nazgulled in forum C Programming
    Replies: 29
    Last Post: 04-07-2007, 09:35 PM
  2. question about multidimensional arrays
    By richdb in forum C Programming
    Replies: 22
    Last Post: 02-26-2006, 08:51 AM
  3. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  4. Array of strings in C
    By szill in forum C Programming
    Replies: 10
    Last Post: 02-22-2005, 04:03 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM

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