Advertisement
Guest User

Calculator on CIL

a guest
Feb 19th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. .assembly extern mscorlib{}
  2. .assembly extern System.Runtime
  3. {
  4. .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
  5. .ver 5:0:0:0
  6. }
  7. .assembly extern System.Console
  8. {
  9. .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
  10. .ver 5:0:0:0
  11. }
  12. .assembly Calculator{}
  13. .module Calculator.exe
  14.  
  15. .namespace Calculator
  16. {
  17. .class public auto ansi beforefieldinit Program extends [System.Runtime]System.Object
  18. {
  19. .method private hidebysig static void Main(string[] args) cil managed
  20. {
  21. .entrypoint
  22. .maxstack 8
  23. .locals init(
  24. [0] int32 firstValue,
  25. [1] int32 secondValue,
  26. [2] string character
  27. )
  28.  
  29. ldstr "Введите первое число: "
  30. call void [System.Runtime]System.Console::Write(string)
  31. call string [System.Runtime]System.Console::ReadLine()
  32. call int32 [System.Runtime]System.Int32::Parse(string)
  33. stloc.0
  34.  
  35. ldstr "Введите второе число: "
  36. call void [System.Runtime]System.Console::Write(string)
  37. call string [System.Runtime]System.Console::ReadLine()
  38. call int32 [System.Runtime]System.Int32::Parse(string)
  39. stloc.1
  40.  
  41. ldstr "Введите знак: "
  42. call void [System.Runtime]System.Console::WriteLine(string)
  43. call string [System.Runtime]System.Console::ReadLine()
  44. stloc.2
  45.  
  46. ldloc.0
  47. ldstr "+"
  48. call bool [System.Runtime]System.String::op_Equality(string, string)
  49. brfalse.s IL_0008
  50.  
  51. IL_0001: ldstr "Result is {0}"
  52. IL_0002: ldloc.0
  53. IL_0003: box [System.Runtime]System.Int32
  54. IL_0004: ldloc.1
  55. IL_0005: box [System.Runtime]System.Int32
  56. IL_0006: call string [System.Runtime]System.String::Format(string, object, object)
  57. IL_0007: call void [System.Runtime]System.Console::WriteLine(string)
  58. br IL_0010
  59.  
  60. IL_0008: ldstr "Undefined character"
  61. IL_0009: call void [System.Runtime]System.Console::WriteLine(string)
  62. IL_0010: ret
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement