#include
#include
#include
using namespace std;
int mian()
{
void print(char *moth[],int y);
char *moth[12]={"January ","February","March","April","May","June","July","August","September","October","November","December"};
cout<<"請輸入月份數:"<<endl;
int num;
cin>>num;
cout<<"對應的英語是:"<<endl;
print(moth,(num-1));
_getch();
return 0;
}
void print(char *moth[],int y)
{
cout<<*moth[y]<<endl;
}
為什麼無法運行
#include
using namespace std;
void print(char *moth);
int main()
{
char moth[][10]={"January ", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
cout<<"請輸入月份數:"<<endl;
int num;
cin>>num;
cout<<"對應的英語是:"<<endl;
print(moth[num-1]);
getchar();
return 0;
}
void print(char *moth)
{
cout<<moth<<endl;
}