hagbard7995
Grünschnabel
Hallo Leute,
ich soll ein Prog in c++ schreiben, welches eine Zeichenkette (zahlen und Vorzeichen) einliest,die einzelnen Zeichen mit einer Pixelmatrix vergleicht und dann eine Zeichenkette aus den Pixelmustern der zeichen ausgibt.
Also bei Eingabe: 1
Ausgabe:
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', 'X', 'X', ' '},
{' ', 'X', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '}
const int spalten = 5;
const int zeilen = 8;
const int spalte_int_line = 6;
const int zeile_int_line = 8;
const int laenge_int_line = 20;
typedef char pixel_font_t[zeilen][spalten];
typedef char pixel_int_line_t[laenge_int_line][zeile_int_line][spalte_int_line];
const pixel_font_t* getPixelsforChar (char aChar);
int fillPixelLineWithInt(int zahl, pixel_int_line_t *zeiger);
const int zeichen = 12;
const pixel_font_t matrix[zeichen] = {
{
{' ', 'X', 'X', 'X', ' '},
{'X', ' ', ' ', ' ', 'X'},
{'X', ' ', ' ', 'X', 'X'},
{'X', ' ', 'X', ' ', 'X'},
{'X', ' ', 'X', ' ', 'X'},
{'X', 'X', ' ', ' ', 'X'},
{'X', ' ', ' ', ' ', 'X'},
{' ', 'X', 'X', 'X', ' '} usw....
const pixel_font_t* getPixelsforChar (char aChar) // Soll als result einen zeiger auf matrix liefern
{
int zmatrix;
if (aChar = '/')
zmatrix = 10;
if (aChar = '-')
zmatrix = 11;
else
zmatrix = (int)aChar;
const pixel_font_t* result;
result = &matrix[zmatrix];
return result;
}
// Nun soll pixel_int_line_t mit den Pixeldarstellungen gefüllt werden
int fillPixelLineWithInt(int zahl, pixel_int_line_t *zeiger)
{
// funktion soll pixel_int_line_t mit pixeln füllen und die Anzahl der dargestellten Symbole zurückgeben. Hab aber keine Ahnung wie?!!?
return result;
}
Kann mir jemand helfen?
ich soll ein Prog in c++ schreiben, welches eine Zeichenkette (zahlen und Vorzeichen) einliest,die einzelnen Zeichen mit einer Pixelmatrix vergleicht und dann eine Zeichenkette aus den Pixelmustern der zeichen ausgibt.
Also bei Eingabe: 1
Ausgabe:
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', 'X', 'X', ' '},
{' ', 'X', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '},
{' ', ' ', ' ', 'X', ' '}
const int spalten = 5;
const int zeilen = 8;
const int spalte_int_line = 6;
const int zeile_int_line = 8;
const int laenge_int_line = 20;
typedef char pixel_font_t[zeilen][spalten];
typedef char pixel_int_line_t[laenge_int_line][zeile_int_line][spalte_int_line];
const pixel_font_t* getPixelsforChar (char aChar);
int fillPixelLineWithInt(int zahl, pixel_int_line_t *zeiger);
const int zeichen = 12;
const pixel_font_t matrix[zeichen] = {
{
{' ', 'X', 'X', 'X', ' '},
{'X', ' ', ' ', ' ', 'X'},
{'X', ' ', ' ', 'X', 'X'},
{'X', ' ', 'X', ' ', 'X'},
{'X', ' ', 'X', ' ', 'X'},
{'X', 'X', ' ', ' ', 'X'},
{'X', ' ', ' ', ' ', 'X'},
{' ', 'X', 'X', 'X', ' '} usw....
const pixel_font_t* getPixelsforChar (char aChar) // Soll als result einen zeiger auf matrix liefern
{
int zmatrix;
if (aChar = '/')
zmatrix = 10;
if (aChar = '-')
zmatrix = 11;
else
zmatrix = (int)aChar;
const pixel_font_t* result;
result = &matrix[zmatrix];
return result;
}
// Nun soll pixel_int_line_t mit den Pixeldarstellungen gefüllt werden
int fillPixelLineWithInt(int zahl, pixel_int_line_t *zeiger)
{
// funktion soll pixel_int_line_t mit pixeln füllen und die Anzahl der dargestellten Symbole zurückgeben. Hab aber keine Ahnung wie?!!?
return result;
}
Kann mir jemand helfen?