for循环遍历没看懂
大哥们帮帮我为啥我看不懂那个for里面int i = (month-1*4)
大哥们帮帮我为啥我看不懂那个for里面int i = (month-1*4)
2021-02-10
//提示信息 System.out.print("您要开始第几周学习啦,直接输入数字吧:"); //设置变量存储接收到的数据 int today = new Scanner(System.in).nextInt(); if(today > 34){ System.out.print("恭喜你已经完成学习计划!!!"); return; } //计算今天是几月(1-月第一周、4-月第4周) int mouth; if (today % 4 == 0) { mouth = today / 4; } else { mouth = (today / 4) + 1; } System.out.print("今天是第" + mouth + "月\n"); //计算输入的周是这个月的第几周 int weekInMouth = today % 4; if (weekInMouth == 0) { weekInMouth = 4; } System.out.print("今天是这个月的第" + weekInMouth + "周\n"); //提示信息 System.out.println("以下是您本月的学习计划, √ 代表当周学习任务"); System.out.println("======================================="); //利用for循环,找到数组中对应这个月的内容输出 for (int i = 1; i < contentList.length; i++) { if (i > ((mouth - 1) * 4) && i <= (mouth * 4)) { if (i % 4 == weekInMouth) { System.out.print("√" + contentList[i - 1] + "\n"); continue; } System.out.print(" " + contentList[i - 1] + "\n"); } }
举报