我必须编写一个程序,用户使用两个整数a和b,其中a对应于一年中的月份(1 = jan,2 = feb等).该程序必须打印"a"和随后的"b"月份之后的月份.这就是我到目前为止所做的,但是对于我输入的每两个整数,我总是得到相同的输出:"1月,2月".任何帮助表示赞赏.
#include<stdio.h>
enum month {jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec}; /*This
allows yoou to name a finite set and to declare identifiers*/
typedef enum month month;
month next_month(month M) /*this is a function definition*/
{
switch (M) /* like an if-else statement, if this month is true goto the M=month you chose*/
{
case jan:
M=feb;break;
case feb:
M=mar;break;
case mar:
M=apr;break;
case apr:
M=may;break;
case may:
M=jun;break;
case jun:
M=jul;break;
case jul:
M=aug;break;
case aug:
M=sep;break;
case sep:
M=oct;break;
case …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个循环,将奇数加到某一点.我怎么能得到整数i上升2.我知道有一种方法,它就像我2,但我不记得确切的命令.如果有人能帮助我,我将不胜感激