Maximilian Krieg
Wissen, Technik & Erfahrungen
Wissen, Technik & Erfahrungen
Wissen, Technik & Erfahrungen

#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
for (int i=0; i<40;i++)
{
for (int j=0; j<75;j++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
int main() {
Frame test;
test.put_point(10,1);
test.frame_dump();
}
*
* File: Frame.cpp
* Author: maximilian.krieg
*
* Created on 12. April 2012, 09:19
*/
#include "Frame.h"
#include <iostream>
using namespace std;
Frame::Frame() {
frame_reset();
}
void Frame::put_point(int x, int y) // Punkt im Frame speichern
{
if (on_frame(x, y)) {
frame[x][y] = on;
}
}
void Frame::frame_reset() // Frame "leeren"
{
for (int x = 0; x < XMAX; x++) {
for (int y = 0; y < YMAX; y++) {
frame[x][y] = off;
}
}
}
void Frame::frame_dump() const // Frame auf die Konsole ausgeben
{
for (int y = YMAX - 1; 0 <= y; --y) {
for (int x = 0; x < XMAX; x++) {
cout.put(frame[x][y]);
}
cout.put('\n');
}
cout.put('\n');
}
bool Frame::on_frame(int x, int y) const // "Clipping"
{
if (XMAX < x) {
return false;
}
if (YMAX < y) {
return false;
}
return true;
}
/*
* File: Frame.h
* Author: maximilian.krieg
*
* Created on 12. April 2012, 09:19
*/
#ifndef FRAME_H
#define FRAME_H
const int XMAX = 55; // Zeichen pro Frame-Zeile
const int YMAX = 34; // Zeilen pro Frame
class Frame {
public:
enum color {
on = ' ', off = '*'
};
Frame();
void put_point(int, int); // Punkt im Frame speichern
void frame_reset(); // Frame "leeren"
void frame_dump() const; // Frame auf die Konsole ausgeben
bool on_frame(int, int) const; // "Clipping"
private:
char frame[XMAX][YMAX];
};
#endif /* FRAME_H */