Thread: How should I tackle this problem and what do I need to know

  1. #1
    Registered User
    Join Date
    Nov 2021
    Posts
    4

    How should I tackle this problem and what do I need to know

    Develop the program, through the use of signatures, definitions and function calls, which reads from the keyboard a line of characters character-by-character ending with '\n' (end-of-line) and writes on the terminal a graphic of horizontal asterisk bars with the occurrences of the read vowels, with the following presentation:How should I tackle this problem and what do I need to know-question-pg1-png

    Code:
    typedef int Vowel[5];
    /**
    * Reads a string of characters from the keyboard and fills array v with
    * the occurrence of each vowel. Index 0 is A, index 1 is E, ..o
    * index 4 is U
    */
    void getVowels( Vowel v );
    /**
    * returns the largest value contained in array v of occurrence of each
    * vowel
    */
    int majorOcurrence( Vowel v );
    /**
    * draws the graph with the presentation suggested in the figure.
    */
    graphic void( Vowel v );
    int main( void ){
    Vowel v={0,0,0,0,0};
    readVowels( v );
    graphic(v); //this function calls the greatestOcurrence(Vowel v):
    return 0;
    }
    I have little to no experience building graphs and my teacher doesn't really gives a intel on what to do. We use the pg/pglib.h to make graphs another think He didnt enter in detail on how to do like how can I write the letters bellow the graph? How to make the graph? my questions are mostly graph related.
    Can you please help me?

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    I have no idea what pg/pglib.h is, but if it creates an image file or some kind of graphical output in a separate window then that is not what this program is asking for. Instead you are meant to create a "graphical" output on the terminal, so you write the letters just by printing letters.
    Code:
    Letras
     |
     |
     |        *
     |        *
     |        *                 *
     |        *     *           *
     |  *     *     *     *     *
     |  *     *     *     *     *
     +-----|-----|-----|-----|------>
        A     E     I     O     U
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Registered User
    Join Date
    Nov 2021
    Posts
    4
    Quote Originally Posted by john.c View Post
    I have no idea what pg/pglib.h is, but if it creates an image file or some kind of graphical output in a separate window then that is not what this program is asking for. Instead you are meant to create a "graphical" output on the terminal, so you write the letters just by printing letters.
    Code:
    Letras
     |
     |
     |        *
     |        *
     |        *                 *
     |        *     *           *
     |  *     *     *     *     *
     |  *     *     *     *     *
     +-----|-----|-----|-----|------>
        A     E     I     O     U
    Then How can I go about making this graph without a graph library, the letters seem to grouped bellow the graph in an specific manner, how can I go abut doing that?

  4. #4
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    You're not thinking.
    The last two lines are simply printed like this:
    Code:
    printf(" +-----|-----|-----|-----|------>\n");
    printf("    A     E     I     O     U\n");
    A little inaccuracy saves tons of explanation. - H.H. Munro

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How people tackle C limitations?
    By rempas in forum C Programming
    Replies: 4
    Last Post: 11-12-2021, 07:28 AM
  2. help with strategy to tackle a project
    By mc61 in forum C++ Programming
    Replies: 6
    Last Post: 04-17-2008, 10:44 AM
  3. When You're ready to tackle games
    By blankstare77 in forum C++ Programming
    Replies: 9
    Last Post: 09-11-2005, 12:05 PM
  4. complete noobie, confused on how to tackle c++
    By fletchpac in forum C++ Programming
    Replies: 7
    Last Post: 07-04-2004, 07:48 AM
  5. How to tackle a debug assertion failure?
    By juhigarg in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2001, 12:59 PM

Tags for this Thread