Add student example inputs

This commit is contained in:
Alex Hirsch
2019-03-18 13:50:36 +01:00
parent 480716b4a9
commit 14da3497ed
45 changed files with 1245 additions and 0 deletions

45
examples/draw/draw.mc Normal file
View File

@@ -0,0 +1,45 @@
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;
}

View File

View File

@@ -0,0 +1,52 @@
xxxxxxxxxx
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
xxxxxxxxxx
xxx
x x
x x
x x
xxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxx
x x
x x
x x
x x
x x
x x
x x
x x
xxxxxxxxxx
xx
xx