uibk_703602-Compiler-Constr.../examples/draw/draw.mc
2019-03-18 13:57:09 +01:00

46 lines
449 B
MonkeyC

void drawrect(int w, int h) {
int i;
int j;
i = 0;
while(i < w) {
print("x");
i = i + 1;
}
print_nl();
i = 2;
while(i < h) {
print("x");
j = 2;
while(j < w) {
print(" ");
j = j + 1;
}
print("x");
print_nl();
i = i + 1;
}
i = 0;
while(i < w) {
print("x");
i = i + 1;
}
print_nl();
}
int main() {
drawrect(10, 15);
drawrect(3, 5);
drawrect(50, 20);
drawrect(10, 10);
drawrect(2, 2);
return 0;
}