Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
39
Task/Exceptions/Aime/exceptions-2.aime
Normal file
39
Task/Exceptions/Aime/exceptions-2.aime
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
void
|
||||
ft(integer a, text &s)
|
||||
{
|
||||
if (a & 1) {
|
||||
s = "odd";
|
||||
error("bad number");
|
||||
} elif (a & a - 1) {
|
||||
s = "not a power of two";
|
||||
error("bad number");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fc(integer a)
|
||||
{
|
||||
text e;
|
||||
|
||||
if (trap(ft, a, e)) {
|
||||
v_text("exception of type `");
|
||||
v_text(e);
|
||||
v_text("' thrown for ");
|
||||
v_integer(a);
|
||||
v_newline();
|
||||
} else {
|
||||
v_text("no exception thrown for ");
|
||||
v_integer(a);
|
||||
v_newline();
|
||||
}
|
||||
}
|
||||
|
||||
integer
|
||||
main(void)
|
||||
{
|
||||
fc(5);
|
||||
fc(6);
|
||||
fc(8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue