question about multiline strings

This is a discussion on question about multiline strings within the C Programming forums, part of the General Programming Boards category; I was just wondering how can i make a multiline string array I want to make a ascii art on ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    150

    question about multiline strings

    I was just wondering how can i make a multiline string array I want to make a ascii art on a pair of dice

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    If you're talking about using one "char" array to store many "lines" of text, just separate each "line" with the newline character, '\n', i.e.
    Code:
    char * lines = "line 1\nline 2\n";

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    150
    isn't there something that I can use to make a picture sorta like this I know you can do it in python i think its like an array using ''' quote marks






    Code:
                      "                                   +-------------+
                                                           |                 |
                                                           |                 |
                                                           +-------------+    "

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    150
    sorry for my bad picture

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    150
    actually this is what it looks like in python I was just wondering can I do this in c

    Code:
    HANGMANPICS = ['''
    4.
    5. +------+
    6. | |
    7. | |
    8. |
    9. |
    10. |
    11. |
    12. |
    13. |
    14. |
    15. |
    16. ==============''', '''

    the hangman pic didn't format right but you get my drift

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    Code:
    char *lines =
    "+---+\n"
    "| * |\n"
    "+---+\n";
    But you have to write the \n in yourself.
    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.

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    150
    Hey thanks that helps a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question about reading in strings and integers
    By sgalland in forum C Programming
    Replies: 6
    Last Post: 11-22-2009, 12:05 AM
  2. Very simple question...annalyze strings
    By BC2210 in forum C Programming
    Replies: 7
    Last Post: 09-21-2009, 10:38 PM
  3. Beginner Question: Problem with scanf and strings. Help!
    By lucidrave in forum C Programming
    Replies: 8
    Last Post: 08-11-2009, 11:22 PM
  4. Multiline strings
    By Bnchs in forum C Programming
    Replies: 2
    Last Post: 05-16-2008, 03:41 PM
  5. Strings question
    By kimimaro in forum C Programming
    Replies: 10
    Last Post: 03-15-2005, 12:14 AM

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