月份名称

月份名称

写一个程序,输入月份(1至12的整数),输出该月的英文月份名称。例如,如果输入3,则程序输出March。本题要求使用指针数组进行处理。

输入只有一个整数,保证值在1至12之间(包含1和12)。

输出输入的月份对应的英文月份名称。
请注意行尾输出换行。
输入

6

输出

June
//月份名称
#include<iostream>
using namespace std;
int main(void)
{
    
    
    int n;
    char month[12][10]={
    
    "January","February","March","April","May","June","July","August","September","October","November","December"};
    char *ptd=month[0];
    cin>>n;
    cout<<*(month+n-1)<<endl;
} 

猜你喜欢

转载自blog.csdn.net/qq_45830912/article/details/114108158