如何在ada83环境中打印整数

时间:2014-04-25 23:11:14

标签: ada

我想在Ada 83中打印整数。目前我只是在使用Text_IO'并且'使用Text_IO'。我不想使用Integer' Image选项进行打印。我想在ada83中使用Integer_Text_IO。请帮我解决语法问题。

我正在使用以下代码:

 with Text_IO;
 use Text_IO;
 i: INTEGER :=1; 
 package Int_IO is new Integer_IO(INTEGER);
 use Int_IO; put(i);

我希望在实例化" Num"中得到有符号整数类型。 '错误。

1 个答案:

答案 0 :(得分:1)

下面的例子,编译,应该有所帮助。

但是,请在StackOverflow上发布问题(或网上的任何地方,真的)向我们展示您实际尝试过的代码。你提供的样本并没有接近编译(第3行的compilation unit expected失败),这使我们很难找到如何帮助你。

如果您尝试使用错误的类型实例化expect signed integer type in instantiation of “Num”(例如Text_IO),则会获得Float

with Text_IO;
procedure Integer_IO_Demo is
   package Int_IO is new Text_IO.Integer_IO (Integer);
begin
   for J in 5 .. 10 loop
      Int_IO.Put (J);
      Text_IO.New_Line;
   end loop;
end Integer_IO_Demo;
相关问题