开发者社区> 问答> 正文

C++的问题 运行问题

#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;
}

为什么无法运行

展开
收起
a123456678 2016-03-05 15:40:23 1697 0
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;
    }
    2019-07-17 18:53:39
    赞同 展开评论 打赏
问答分类:
C++
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
使用C++11开发PHP7扩展 立即下载
GPON Class C++ SFP O;T Transce 立即下载
GPON Class C++ SFP OLT Transce 立即下载