NEED SOME HELP GUYS.... :(

Discussion in 'C++' started by Joe Black, Oct 9, 2004.

  1. Joe Black

    Joe Black Guest

    Just to inform you guys that i have only like 2 weeks that i took my
    first classes in c++, and my proffesor now is asking me to solve this
    problem:
    /// Using a function create a Win32 Console Application which outputs
    asterisks (*)on the screen displaying your name like a matrix screen.
    it has to be in a top down-design style. PLS HELP THIS AMATEUR
    STUDENT. *_*
    if you can help me just send the source code... even that i cant do
    that i can fidure out that it should be simple.
    thank you Joe
    Joe Black, Oct 9, 2004
    #1
    1. Advertising

  2. Joe Black

    JKop Guest

    Joe Black posted:

    > Just to inform you guys that i have only like 2 weeks that i took my
    > first classes in c++, and my proffesor now is asking me to solve this
    > problem:
    > /// Using a function create a Win32 Console Application which outputs
    > asterisks (*)on the screen displaying your name like a matrix screen.
    > it has to be in a top down-design style. PLS HELP THIS AMATEUR
    > STUDENT. *_*
    > if you can help me just send the source code... even that i cant do
    > that i can fidure out that it should be simple.
    > thank you Joe
    >


    Step 1:

    Open Notepad, pick a monospace font and design your name.


    Step 2:

    Use standard output to output the string.



    Google for "cout".


    -JKop
    JKop, Oct 9, 2004
    #2
    1. Advertising

  3. Joe Black

    Mike Wahler Guest

    "Joe Black" <> wrote in message
    news:...
    > Just to inform you guys that i have only like 2 weeks that i took my
    > first classes in c++, and my proffesor now is asking me to solve this
    > problem:
    > /// Using a function create a Win32 Console Application which outputs
    > asterisks (*)on the screen displaying your name like a matrix screen.
    > it has to be in a top down-design style.


    That seems to me a reasonable assignment after two weeks of
    classes.

    > PLS HELP THIS AMATEUR
    > STUDENT. *_*


    Of course we'll help you. What we will not do is do it for you.
    Show us the code of your best attempt, and ask specific questions.

    > if you can help me just send the source code...


    Sending you the code would help you not at all (it might help
    you pass your course, if you didn't get caught cheating, that is).
    It certainly would not help you learn. "Give a man a fish", and
    all that.

    >even that i cant do


    Did you even try? If so, show us the code. If not, try.

    > that i can fidure out that it should be simple.


    It is relatively simple.

    Hints: Don't try to do it all at once. Do a little at a time,
    testing as you go. Don't add more until what you have works
    correctly. E.g. first write something that outputs a series
    of asterisks (any number of them). Then perhaps something
    which outputs a series of asterisks with interspersed spaces
    (again, use any number of asterisks or spaces, just to get a
    feel for things.) Then try to do the output on more than one
    line. Then do multiple lines of differing lengths. Then
    multiple lines with differing numbers of asterisks, then with
    the spaces at differnent locations on a line, then differing
    numbers of spaces, etc. etc.

    Walk before you run. Here's a simple skeleton program to
    get you started:

    #include <iostream>

    void ast(unsigned int how_many)
    {
    for(unsigned int i = 0; i < how_many; ++i)
    std::cout << '*';

    std::cout << '\n';
    }

    int main()
    {
    ast(42);
    ast(25);
    return 0;
    }

    -Mike
    Mike Wahler, Oct 9, 2004
    #3
  4. Joe Black

    Mike Wahler Guest

    "JKop" <> wrote in message
    news:CvX9d.33092$...
    > Joe Black posted:
    >
    > > Just to inform you guys that i have only like 2 weeks that i took my
    > > first classes in c++, and my proffesor now is asking me to solve this
    > > problem:
    > > /// Using a function create a Win32 Console Application which outputs
    > > asterisks (*)on the screen displaying your name like a matrix screen.
    > > it has to be in a top down-design style. PLS HELP THIS AMATEUR
    > > STUDENT. *_*
    > > if you can help me just send the source code... even that i cant do
    > > that i can fidure out that it should be simple.
    > > thank you Joe
    > >

    >
    > Step 1:
    >
    > Open Notepad, pick a monospace font and design your name.
    >
    >
    > Step 2:
    >
    > Use standard output to output the string.


    I seriously doubt that is a solution which would be
    accepted by the instructor. I'm fairly certain he's
    looking for loops. But of course one should verify
    that before proceeding.


    -Mike
    Mike Wahler, Oct 9, 2004
    #4
  5. "Joe Black" <> wrote in message
    news:...
    > Just to inform you guys that i have only like 2 weeks that i took my
    > first classes in c++, and my proffesor now is asking me to solve this
    > problem:
    > /// Using a function create a Win32 Console Application which outputs
    > asterisks (*)on the screen displaying your name like a matrix screen.
    > it has to be in a top down-design style. PLS HELP THIS AMATEUR
    > STUDENT. *_*
    > if you can help me just send the source code... even that i cant do
    > that i can fidure out that it should be simple.
    > thank you Joe


    Normally I don't help with homework whenthe poster has made no attempt
    themselves. But this is so easy that I figure its not going to do you any
    harm to give you the solution.

    #include <iostream>

    int main()
    {
    std::cout << "***** *** *****\n";
    std::cout << " * * * *\n";
    std::cout << " * * * ****\n";
    std::cout << " * * * *\n";
    std::cout << "** *** *****\n";
    }

    (best viewed using a fixed width font).

    Good luck on the rest of your course, it is going to get a lot more
    difficult than this.

    john
    John Harrison, Oct 9, 2004
    #5
  6. Joe Black

    osmium Guest

    "Joe Black" writes:

    > Just to inform you guys that i have only like 2 weeks that i took my
    > first classes in c++, and my proffesor now is asking me to solve this
    > problem:
    > /// Using a function create a Win32 Console Application which outputs
    > asterisks (*)on the screen displaying your name like a matrix screen.
    > it has to be in a top down-design style. PLS HELP THIS AMATEUR
    > STUDENT. *_*
    > if you can help me just send the source code... even that i cant do
    > that i can fidure out that it should be simple.
    > thank you Joe


    I wouldn't classify any of the help or solutions I have seen posted as
    meeting the top down stipulation. I think he wants something with more
    potential to be an actual program that has the potential,at least, to be
    used by someone who wasn't named Joe. It is possible, of course, that there
    are responses I haven't seen.

    Early dot matrix printers used a 5 x7 matrix. I doubt very much if there is
    any automated way to produce the 52 latin letters. But you could write a
    program that handles Joe so far, and has the potential for other names as
    well. Get a piece of graph paper and start doodling in a 5 x 7 array. You
    will see several strokes that are widely used. Five asterisks in a
    horizontal row, for example, on the E, F, L, Z, .... There are also short
    bars, *perhaps* rounded corners, slanted bars, (K and R) And so on. A
    switch statement *might be* useful, I don't really know, I haven't thought
    about it that much.
    osmium, Oct 9, 2004
    #6
  7. * osmium:
    >
    > Early dot matrix printers used a 5 x7 matrix. I doubt very much if there is
    > any automated way to produce the 52 latin letters.


    Aah, you forgot: to Peek the ROM!

    Oops, that was Basic, 1970's (I used that technique to present somewhat
    derogatory comments about the principal of our high school, it was very
    clever because I accessed the lowercase letters in spite of the keyboard
    only producing uppercase).

    But I'm fairly certain that 5*7 character data must be on the net somewhere,
    if only for ASCII art.


    > But you could write a
    > program that handles Joe so far, and has the potential for other names as
    > well. Get a piece of graph paper and start doodling in a 5 x 7 array. You
    > will see several strokes that are widely used. Five asterisks in a
    > horizontal row, for example, on the E, F, L, Z, .... There are also short
    > bars, *perhaps* rounded corners, slanted bars, (K and R) And so on. A
    > switch statement *might be* useful, I don't really know, I haven't thought
    > about it that much.


    Arrays.

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
    Alf P. Steinbach, Oct 10, 2004
    #7
  8. Joe Black

    Moonlit Guest

    Hi,

    "Joe Black" <> wrote in message
    news:...
    > Just to inform you guys that i have only like 2 weeks that i took my
    > first classes in c++, and my proffesor now is asking me to solve this
    > problem:
    > /// Using a function create a Win32 Console Application which outputs
    > asterisks (*)on the screen displaying your name like a matrix screen.
    > it has to be in a top down-design style. PLS HELP THIS AMATEUR
    > STUDENT. *_*
    > if you can help me just send the source code... even that i cant do
    > that i can fidure out that it should be simple.
    > thank you Joe


    Hi,

    Some pointers and ideas.

    Look into
    -CreateDIBSection
    -TextOut
    -CreateFont

    etc.

    Write something to the bitmap
    Then read the bits that make up the bitmap and output a star to the console
    if a bit is set..

    Look on microsoft MSDN or the compilers help pages for a description of the
    various functions.

    Well the rest is up to you.

    Regards, Ron AF Greve.
    Moonlit, Oct 10, 2004
    #8
  9. Joe Black

    JKop Guest

    John Harrison posted:

    >
    > "Joe Black" <> wrote in message
    > news:...
    >> Just to inform you guys that i have only like 2 weeks that i took my
    >> first classes in c++, and my proffesor now is asking me to solve this
    >> problem: /// Using a function create a Win32 Console Application which
    >> outputs asterisks (*)on the screen displaying your name like a matrix
    >> screen. it has to be in a top down-design style. PLS HELP THIS
    >> AMATEUR STUDENT. *_*
    >> if you can help me just send the source code... even that i cant do
    >> that i can fidure out that it should be simple.
    >> thank you Joe

    >
    > Normally I don't help with homework whenthe poster has made no attempt
    > themselves. But this is so easy that I figure its not going to do you
    > any harm to give you the solution.
    >
    > #include <iostream>
    >
    > int main()
    > {
    > std::cout << "***** *** *****\n";
    > std::cout << " * * * *\n";
    > std::cout << " * * * ****\n";
    > std::cout << " * * * *\n";
    > std::cout << "** *** *****\n";
    > }
    >
    > (best viewed using a fixed width font).
    >
    > Good luck on the rest of your course, it is going to get a lot more
    > difficult than this.
    >
    > john
    >
    >


    Why the multiple calls to cout?

    #include <iostream>

    int main()

    std::cout <<

    "***** *** *****\n"
    " * * * *\n"
    " * * * ****\n"
    " * * * *\n"
    "** *** *****\n";
    }


    -JKop
    JKop, Oct 10, 2004
    #9
  10. Joe Black

    Pedro Graca Guest

    JKop wrote:
    > John Harrison posted:
    >>
    >> #include <iostream>
    >>
    >> int main()
    >> {
    >> std::cout << "***** *** *****\n";
    >> std::cout << " * * * *\n";
    >> std::cout << " * * * ****\n";
    >> std::cout << " * * * *\n";
    >> std::cout << "** *** *****\n";
    >> }

    >
    > #include <iostream>
    >
    > int main()
    >
    > std::cout <<
    >
    > "***** *** *****\n"
    > " * * * *\n"
    > " * * * ****\n"
    > " * * * *\n"
    > "** *** *****\n";
    > }


    [newbie here]

    Shouldn't you both

    std::cout << std::endl;

    to flush the 'cout' stream?

    Or the final '\n' does it on its own?
    Or it really isn't needed? (I think I read somewhere it *IS* needed)

    --
    ================== My mail address is spam-trapped ==================
    If my name is not in the "To:" line; or if you send a "Content-Type:"
    different than "text/plain" (optionally followed by anything); or
    if message size is greater than 10K -- your mail _will_be_ /dev/null'ed
    Pedro Graca, Oct 10, 2004
    #10
  11. Joe Black

    red floyd Guest

    Moonlit wrote:
    > Hi,
    >
    > "Joe Black" <> wrote in message
    > news:...
    >
    >>Just to inform you guys that i have only like 2 weeks that i took my
    >>first classes in c++, and my proffesor now is asking me to solve this
    >>problem:
    >>/// Using a function create a Win32 Console Application which outputs
    >>asterisks (*)on the screen displaying your name like a matrix screen.
    >>it has to be in a top down-design style. PLS HELP THIS AMATEUR
    >>STUDENT. *_*
    >>if you can help me just send the source code... even that i cant do
    >>that i can fidure out that it should be simple.
    >> thank you Joe

    >
    >
    > Hi,
    >
    > Some pointers and ideas.
    >
    > Look into
    > -CreateDIBSection
    > -TextOut
    > -CreateFont
    >
    > etc.
    >
    > Write something to the bitmap
    > Then read the bits that make up the bitmap and output a star to the console
    > if a bit is set..
    >
    > Look on microsoft MSDN or the compilers help pages for a description of the
    > various functions.
    >
    > Well the rest is up to you.
    >
    > Regards, Ron AF Greve.
    >
    >


    Your answer is *WRONG*. He said "Console App". And the Win32 API is OT
    in this forum.
    red floyd, Oct 10, 2004
    #11
  12. Joe Black

    Mike Wahler Guest

    "Pedro Graca" <> wrote in message
    news:-berlin.de...
    > JKop wrote:
    > > John Harrison posted:


    > > std::cout <<
    > >
    > > "***** *** *****\n"
    > > " * * * *\n"
    > > " * * * ****\n"
    > > " * * * *\n"
    > > "** *** *****\n";
    > > }

    >
    > [newbie here]
    >
    > Shouldn't you both
    >
    > std::cout << std::endl;
    >
    > to flush the 'cout' stream?


    Only if you need to ensure previous output appears
    before subsequent output. Not applicable here, but
    also note that performing input with 'cin' after
    output with 'cout' will cause 'cout' to be flushed
    before the input.

    >
    > Or the final '\n' does it on its own?


    Yes, since the scope (of main()) will be exited, invoking
    'cout's destructor, which will cause a flush.

    > Or it really isn't needed? (I think I read somewhere it *IS* needed)


    See above.

    -Mike
    Mike Wahler, Oct 10, 2004
    #12
  13. Joe Black wrote:
    > Just to inform you guys that i have only like 2 weeks that i took my
    > first classes in c++, and my proffesor now is asking me to solve this
    > problem:
    > /// Using a function create a Win32 Console Application which outputs
    > asterisks (*)on the screen displaying your name like a matrix screen.
    > it has to be in a top down-design style. PLS HELP THIS AMATEUR
    > STUDENT. *_*
    > if you can help me just send the source code... even that i cant do
    > that i can fidure out that it should be simple.
    > thank you Joe


    This will be for 5 x 7 fonts, but can be applied to
    3 x 5 or any other size.

    The easiest method is to have a 5 x 7 matrix (array or vector of
    vectors) to contain the character pattern:
    0 1 2 3 4
    0 * * * * *
    1 *
    2 *
    3 *
    4 *
    5 *
    6 *

    Let us call each one a cell. If you use constant C style strings,
    you data structure would look like:
    char t_cell[CELL_HEIGHT][CELL_WIDTH + 1];
    The "+1" is to account for the terminating null character.

    Let us define a font as a collection, or aggregate of cells.
    Generally, there is one cell for each printable character in
    the font. A simple method is to make this an array, which
    would be a 3 dimensional array:
    char font[NUM_OF_CHARS][CELL_HEIGHT][CELL_WIDTH + 1];

    Note: I suggested arrays because the font is composed of
    constant data. This method requires no extra effort to copy
    the data into a dynamic structure such as a vector, list
    or map.

    To print out a row of characters, use the expression:
    font[character - start_char][row_index];
    where "character" is the current character being processed
    "start_char" is the first character in the font.

    So the loop is to print each row of the font for each character:
    for each row do:
    print font['T' - 'A'][row]
    print inter-character-spacing
    print font['O' - 'A'][row]
    print inter-character-spacing
    print font['M' - 'A'][row]
    print newline.
    end-for

    This is the basic algorithm. Further optimizations and
    data content are left for the reader.


    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.comeaucomputing.com/learn/faq/
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    http://www.sgi.com/tech/stl -- Standard Template Library
    Thomas Matthews, Oct 11, 2004
    #13
  14. Joe Black

    Pedro Graca Guest

    Mike Wahler wrote:
    >
    > "Pedro Graca" <> wrote in message
    > news:-berlin.de...


    [edited]
    >> Or [std::cout << std::endl; at the end of main()] really isn't
    >> needed? (I think I read somewhere it *IS* needed)


    I must have misinterpreted what I read.

    [edited]
    > [It isn't needed], since the scope (of main()) will be exited,
    > invoking 'cout's destructor, which will cause a flush.


    Ah! :)

    Thank you for your explanations Mike, I really appreciate it.
    Pedro Graca, Oct 11, 2004
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Snake
    Replies:
    7
    Views:
    350
    Evan Carew
    Jan 21, 2004
  2. Kenny McCormack
    Replies:
    3
    Views:
    333
    spinoza1111
    Nov 12, 2009
  3. John
    Replies:
    0
    Views:
    87
  4. PookiesChatz

    Newbie help...please guys

    PookiesChatz, May 28, 2007, in forum: Javascript
    Replies:
    0
    Views:
    59
    PookiesChatz
    May 28, 2007
  5. Lew
    Replies:
    1
    Views:
    199
    Robert Klemme
    Aug 1, 2012
Loading...

Share This Page