本帖最后由 你说呢 于 2015-7-21 09:08 编辑
关于星期的输出 提示有
[Error] invalid conversion from 'const char*' to 'char*' [-fpermissive]
[Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]
#include<stdio.h>
char * getDay(int n){
char *days[]={ "星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
return n<8&&n>0? days[n-1]:"重新输入";
}
int main(){
int n=0;
scanf(”%d",&n);
printf("%s\n",getDay(n);
return 0;
} |
|