c语言要求编一程序主函数输入周几,通过调用指针函数,在主函数中输出该周几的英文

[复制链接]
查看11 | 回复3 | 2011-12-23 22:04:57 | 显示全部楼层 |阅读模式
楼上用的是函数指针的方法,但貌似LZ是用指针函数应该是int *fun();这种如下给出指针函数周几的翻译功能#include #include char *translate(char a[],int num);//指针函数声明void main(){int num;char a[10];printf("请输入周几:阿拉伯数字(1~7)\n");while(scanf("%d",&num))printf("%s\n",translate(a,num));}char *translate(char a[],int num){
switch(num)
{ ...
回复

使用道具 举报

千问 | 2011-12-23 22:04:57 | 显示全部楼层
//不好意思没看清你的要求,现在更正了#include #include char *printfDay(int index,char *eng){strcpy(eng,"");char *week[] = {"Monday","Tuesday","Wednesday","Thursday...
回复

使用道具 举报

千问 | 2011-12-23 22:04:57 | 显示全部楼层
你是在练习这个吗?指向函数的指针?void mon(void){
printf("monday");
}void tue(void){
printf("tuesday");
}void wed(void){
printf("wensday");
}void thr(void){
prin...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行