Austin Powers answers your questions about program #9

  1. Q: How do I change my letters to uppercase?

    A:

    Use the function : int toupper(char ch);

    Don't forget the #include <ctype.h>

    It works like so:

      char ch1,ch2;
      ch1 = 'a';
      ch2 = toupper(ch1);
    
    Where ch2 will get 'A'


  2. Q: I'm freaking out here!! How do I get started!

    A: Don't freak baby.

    But you are going to need a few while loops.

    First, start with one word you want to find, let's say cat.
    Then search the whole 2-D array for a 'c'. Whenever you find one, check to see if the next column has an 'a', and the next a 't'. If it does, then switch those letters to UPPERCASE. (this will work for 9a only, not 9b, I'll leave that to you to figure out)

    To do all this, you will find you need another 2-D array (of characters) to hold all the names. And probably a third 1-D array to hold the sizes of each of the words.


  3. Q: How is the 'wordsearch' input. Do we define it within the program or is each point input?

    A: Don't define it in the program itself but read it in from the user. This is easier to do than it sounds. Grab Glinert's sample file from his directory and create another file similar to his (you'll have two different input files). Then redirect the input like so :

        g++ -o p9 p9.C
        p9 < p9data
    
    Where p9 is your program and p9data is the file that has the wordsearch in it. What happens is that whenever you do a cin, it gets its info from p9data.


<---- Comp Sci 1 Homepage