你这么改:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *Day[]={"Monday","Tuesday","Wednesday","thursday","Friday","Saturday","Sunday"};
void Dchange(char *pstr);
int main(int argc, char *argv[])
{
printf("%d",argc);
if(argc!=3)
//判断输入格式是否为两位
{
printf("输入格式错误 ,请按照例子输入,如ChangeDay 1");
exit(0);
}
if(argv[2][0]>='1'&&argv[2][0]<='7')
{
printf("英文表示为:\n");
Dchange(argv[2]);
}
else
{
printf("输入为整数且范围在1~7");
exit(0);
}
}
void Dchange(char *pstr)
{
printf("%s",Day[(atoi(pstr)-1)]);
}
我试过了,输入changeday 2,可以得Tuesdayna ,不知道是不是你要的结果