C++的问题

源码工坊 其他问答 1
#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;
}

为什么无法运行?

回复

共1条回复 我来回复
  • 毕设客栈
    这个人很懒,什么都没有留下~
    评论
    #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;
    }
    
    0条评论

发表回复

登录后才能评论