| Date | 2011/4/9 |
|---|---|
| Name | Add Two Numbers |
| Description | Add Two Numbers using Common Intermediate Language |
| Filename | AddTwoNumObjC.c |
| Content |
|
| Sample Input: | 123 3.5 dsfasd 4 fdsafds 6 |
| Sample Output: | 126 0 |
| Expected Test Command: | ilasm HelloFriendCIL.il HelloFriendCIL.exe |
.assembly extern mscorlib{}
.assembly HelloFriendCIL{}
.class private auto ansi beforefieldinit HelloFriendCIL extends [mscorlib]System.Object{
.method public hidebysig static void Main() cil managed{
.entrypoint
.maxstack 2
.locals init (string V_0, bool V_1)
START: ldstr "Your name\?"
call void [mscorlib]System.Console::Write(string)
call string [mscorlib]System.Console::ReadLine()
stloc.0
ldloc.0
ldnull
ceq
stloc.1
ldloc.1
brtrue.s EOF
ldstr "Hello, "
ldloc.0
call string [mscorlib]System.String::Concat(string, string)
call void [mscorlib]System.Console::WriteLine(string)
br.s START
EOF: ret
}
}
| Date | 2011/4/8 |
|---|---|
| Name | Hello Friend |
| Description | Ask user's name and echo greeting message to user using Common Intermediate Language |
| Filename | HelloFriendCIL.il |
| Content |
|
| Sample Input: | Peter Pan |
| Sample Output: | Hello, Peter Pan! |
| Expected Test Command: | ilasm HelloFriendCIL.il HelloFriendCIL.exe |
.assembly extern mscorlib{}
.assembly HelloFriendCIL{}
.class private auto ansi beforefieldinit HelloFriendCIL extends [mscorlib]System.Object{
.method public hidebysig static void Main() cil managed{
.entrypoint
.maxstack 2
.locals init (string V_0, bool V_1)
START: ldstr "Your name\?"
call void [mscorlib]System.Console::Write(string)
call string [mscorlib]System.Console::ReadLine()
stloc.0
ldloc.0
ldnull
ceq
stloc.1
ldloc.1
brtrue.s EOF
ldstr "Hello, "
ldloc.0
call string [mscorlib]System.String::Concat(string, string)
call void [mscorlib]System.Console::WriteLine(string)
br.s START
EOF: ret
}
}
| Date | 2011/4/7 |
|---|---|
| Name | Hello World |
| Description | Display greeting message to user using Common Intermediate Language |
| Filename | HelloWorldCIL.il |
| Content |
|
| Sample Input: | |
| Sample Output: | Hello, World! |
| Expected Test Command: | ilasm HelloWorldCIL.il HelloWorldCIL.exe |
.assembly extern mscorlib{}
.assembly HelloWorldCIL{}
.class private auto ansi beforefieldinit HelloWorldCIL extends [mscorlib]System.Object{
.method public hidebysig static void Main() cil managed{
.entrypoint
ldstr "Hello, World!"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
}