如何打印日历的日期
我正在使用 Gnat(ada95 的旧编译器),但在打印日期时遇到问题。
我声明:(with Ada.calendar
)
Cdate: Calendar.Time;
Cdate := Calendar.Time_Of(Year => 2010, Month => 1, Day => 10);
现在我尝试打印它 -
Put_Line("Year : " & Year(Cdate)'Img);
但我没能做到......
I'm using Gnat (old compiler of ada95) and I'm having problem to print the date.
I declared : (with Ada.calendar
)
Cdate: Calendar.Time;
Cdate := Calendar.Time_Of(Year => 2010, Month => 1, Day => 10);
Now I've tried to print it -
Put_Line("Year : " & Year(Cdate)'Img);
But I didn't managed to do so...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只提供了程序片段,因此很难判断您实际编写的内容以及尝试运行的内容。而且你没有指出它“如何”不起作用。是不是没有编译通过?是否已编译但运行不正确?
如果片段是从代码中按原样剪切并粘贴到此处的,则您可能会遇到语法错误。
这是一个完整工作的程序,可以完成您想要的操作:
这是使用 Gnat 编译和运行的,虽然您可能使用它的旧版本,但它本身并不是“旧编译器”,它是最新/最好的免费版本GNAT GPL 2009 很容易获得。
You only provided program fragments, so it's hard to tell what you actually wrote and are trying to run. And you didn't indicate "how" it didn't work. Did it not compile? Did it compile but not run correctly?
If the fragments were cut as-is from your code and pasted here, you've probably gotten syntax errors.
Here's a fully working program that does what you appear to want:
This was compiled and run using Gnat, and while you may be using an old version of it, it is not itself an "old compiler", the latest/greatest free version of it, GNAT GPL 2009, is readily available.