Joe said:
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