當前位置:編程學習大全網 - 電腦編程 - 求:編寫程序,輸出1~12月份對應的英文月份名稱,要求使用枚舉類型變量和二維數組結合進行處理。

求:編寫程序,輸出1~12月份對應的英文月份名稱,要求使用枚舉類型變量和二維數組結合進行處理。

#include<iostream.h>

void main()

{

char *monthname[]={"January","February","March","April","May","June","July","August","September","October","November","December"};

int i;

while(1)

{

cout<<"Please input month No.(1~12):\n";

cin>>i;

if ( i<1||i>12)

{

cout<<"Error!"<<endl;

break;

}

cout<<"month No."<<i<<"---->"<<monthname[i-1]<<endl;

}

}

  • 上一篇:asp.net html內插入字符串變量
  • 下一篇:長方形長160厘米,寬270厘米。如何打壹個鉆石洞?
  • copyright 2024編程學習大全網