WordSquare Problem Pt 1

This is a discussion on WordSquare Problem Pt 1 within the C Programming forums, part of the General Programming Boards category; I have been given a project concerning a wordsquare. One part of the assignment is displaying the wordsquare (2d array). ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    4

    WordSquare Problem Pt 1

    I have been given a project concerning a wordsquare.

    One part of the assignment is displaying the wordsquare (2d array).

    I understand i need to read in a file.

    My 1st question is, do i need to store the file that i have read in anywhere so i can display it?

    My 2nd question is, how do i display the wordsquare.

    I am using Vim for writing code and Terminal for compiling code if this helps.

    Thanks in advance.

  2. #2
    pwning noobs Zlatko's Avatar
    Join Date
    Jun 2009
    Location
    The Great White North
    Posts
    132
    James, you need to provide a bit more information. What is in your input file? What should the output look like? What is a wordsquare?

    Sure you need to store your file input into something if you plan to do some processing on it.

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    4
    A word square is essentially like a grid of rows and columns with letters in them. People are then asked to find words in the word square that match up to a list of words given. You usually find them in papers, or when you were younger in like a spelling book.

    My input is a sample grid-file containing letters. Its a 7 x 12 if that helps. My other input is a sample word-file containing the list of words I need to scan for.

    My assumption with "what shall the output" is what should your print out be of.

    Basically i want the print out to be of the initial display of the grid.

    Hopefully this has made it easier to understand.

  4. #4
    pwning noobs Zlatko's Avatar
    Join Date
    Jun 2009
    Location
    The Great White North
    Posts
    132
    James, if the files just need to be displayed on the screen, then all you need to do is open the file with fopen, read in lines with fgets, until the end of the file, and print each line out after reading it with printf or fputs.

    The fgets will return NULL when you've hit the end of the file. You need a char array to hold the line.

    Do you need to draw the actual grid? Something like this:

    Code:
    +-+-+
    |A|B|C
    +-+-+
    |E|F|G
    Last edited by Zlatko; 08-28-2009 at 10:15 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

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