一个简单的C语言编程!

来源:百度知道 编辑:UC知道 时间:2024/09/23 12:26:41
Using the structure define in Questions 2, write a C program that accepts a month from a user in numeric form and displays the name of the month and the number of days in the month. Thus,in response to an input of 3, the pfogram displays March has 31 days.
编程就贴在下面,谢谢!

Using the structure define in Questions 2,拜托把问题2中定义的结构体粘上来,谢谢。

如果用自己写的结构体,代码如下:
//t.c
//Author:pig@ubuntu
//Date:2009-6-7
#include <stdio.h>
#include <stdlib.h>

#define M 10
struct month
{
int mon_seq;
int day_count;
};

int main()
{
struct month a[12];
char month_name[][12]={"",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"};
int i;
for(i=1;i<=12;i++)
{
a[i].mon_seq=i;
if(2==i)
{
a[i].day_count=28;
continue;
}
if(i<8)
{
if((0==i%2))
a[i].day_count=