By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 922 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

NEED SOME HELP GUYS.... :(

P: n/a
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
Jul 22 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
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
Jul 22 '05 #2

P: n/a
"Joe Black" <pr**********@hotmail.com> wrote in message
news:f1**************************@posting.google.c om...
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


Jul 22 '05 #3

P: n/a

"JKop" <NU**@NULL.NULL> wrote in message
news:Cv*******************@news.indigo.ie...
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
Jul 22 '05 #4

P: n/a

"Joe Black" <pr**********@hotmail.com> wrote in message
news:f1**************************@posting.google.c om...
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
Jul 22 '05 #5

P: n/a
"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.


Jul 22 '05 #6

P: n/a
* 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?
Jul 22 '05 #7

P: n/a
Hi,

"Joe Black" <pr**********@hotmail.com> wrote in message
news:f1**************************@posting.google.c om...
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.
Jul 22 '05 #8

P: n/a
John Harrison posted:

"Joe Black" <pr**********@hotmail.com> wrote in message
news:f1**************************@posting.google.c om...
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
Jul 22 '05 #9

P: n/a
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
Jul 22 '05 #10

P: n/a
Moonlit wrote:
Hi,

"Joe Black" <pr**********@hotmail.com> wrote in message
news:f1**************************@posting.google.c om...
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.
Jul 22 '05 #11

P: n/a

"Pedro Graca" <he****@hotpop.com> wrote in message
news:sl*******************@ID-203069.user.uni-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
Jul 22 '05 #12

P: n/a
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

Jul 22 '05 #13

P: n/a
Mike Wahler wrote:

"Pedro Graca" <he****@hotpop.com> wrote in message
news:sl*******************@ID-203069.user.uni-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.

Jul 22 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.