fork(1) download
  1. with Ada.Strings.Unbounded;
  2. with Text_IO;
  3.  
  4. use Ada.Strings.Unbounded;
  5.  
  6. procedure Coordenates is
  7. function Custom_Binary(letter: Character) return Unbounded_String is
  8. -- Tendrás que "Execute" el programa / "Excecute" me
  9. value, reminder: Integer;
  10. binary: Unbounded_String;
  11. begin
  12. value := Character'Pos(letter);
  13. while value /= 0 loop
  14. reminder := value mod 2;
  15. value := value / 2 -- (òÓ)
  16. binary := Integer'Image(reminder) & binary;
  17. Delete(binary, 1, 1);
  18. end loop;
  19.  
  20. if Length(binary) = 6 then
  21. binary := Integer'Image(0) & binary;
  22. Delete(binary, 1, 1);
  23. end if;
  24.  
  25. return(binary);
  26. end Custom_Binary;
  27.  
  28. a, b, c: Unbounded_String;
  29. begin
  30. a := To_Unbounded_String("XXXX"); -- respuesta A / response A
  31. b := To_Unbounded_String("XXXXXXXXXX"); -- respuesta B / response B
  32. c := To_Unbounded_String("X"); -- respuesta C / response C
  33.  
  34. Text_IO.Put("El mensaje de Ada a Alan");
  35. Text_IO.Put(" / ") -- \(^-^)/
  36. Text_IO.Put_Line("The message from Ada to Alan:");
  37.  
  38. Text_IO.Put(To_String(Custom_Binary('6')));
  39. Text_IO.Put(To_String(Custom_Binary('b')));
  40. if a = "1815" then
  41. Text_IO.Put("000");
  42. end if;
  43. Text_IO.Put(To_String(Custom_Binary('a')));
  44. Text_IO.Put(To_String(Custom_Binary('H')));
  45. if b = "BABBAGE" then
  46. Text_IO.Put("111");
  47. end if;
  48. Text_IO.Put("000");
  49. Text_IO.Put(To_String(Custom_Binary('M')));
  50. if c = "G" then
  51. Text_IO.Put("10111101");
  52. end if;
  53. end Coordenates;
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
x86_64-linux-gnu-gcc-8 -c -pipe -O2 test.adb
test.adb:6:11: warning: file name does not match unit name, should be "coordenates.adb"
test.adb:15:35: missing ";"
test.adb:35:27: missing ";"
x86_64-linux-gnu-gnatmake-8: "test.adb" compilation error
stdout
Standard output is empty