小编use*_*820的帖子

循环遍历Haskell中的地图数据结构

我有一个具有以下结构的地图数据结构: - "英国的首都" - >"伦敦""法国的首都" - >"巴黎"我想循环显示这个问题的地图: "英国的首都是什么",要求用户输入.如果用户回答"伦敦",我打印正确,否则,我打印正确答案"伦敦".这在像C#这样的命令式语言中很容易,但我还没想到如何在Haskell中做到这一点.

dictionary haskell loops

2
推荐指数
1
解决办法
1310
查看次数

导入java.time.LocalDate失败

import java.time.LocalDate;
import java.time.Period;

    public class DateDiff {

        public static void main(String[] args) {
            /** The date at the end of the last century */
            LocalDate endofCentury = LocalDate.of(2000, 12, 31);
            LocalDate now = LocalDate.now();

            Period diff = Period.between(endofCentury, now);

            System.out.printf("The 21st century (up to %s) is %s old%n", now, diff);
            System.out.printf("The 21st century is %d years, %d months and %d days old",
                    diff.getYears(), diff.getMonths(), diff.getDays());
        }
    }
Run Code Online (Sandbox Code Playgroud)

没有找到本地日期我错过了一个import指令

java date java-time

0
推荐指数
1
解决办法
5080
查看次数

标签 统计

date ×1

dictionary ×1

haskell ×1

java ×1

java-time ×1

loops ×1