C语言帮忙找出下列各段程序中的语法和逻辑错误.main(){int num1,num2;printf("Please enter two numbers:");scanf("%d%d",&num1,&num2);printf("Max=%d,Min=%d\n",max_min(int num1,int numb2));}int max_min(number1,number2){int max,min;max=nu
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 01:48:32
C语言帮忙找出下列各段程序中的语法和逻辑错误.main(){int num1,num2;printf("Please enter two numbers:");scanf("%d%d",&num1,&num2);printf("Max=%d,Min=%d\n",max_min(int num1,int numb2));}int max_min(number1,number2){int max,min;max=nu
C语言帮忙找出下列各段程序中的语法和逻辑错误.
main()
{
int num1,num2;
printf("Please enter two numbers:");
scanf("%d%d",&num1,&num2);
printf("Max=%d,Min=%d\n",max_min(int num1,int numb2));
}
int max_min(number1,number2)
{
int max,min;
max=number1>number2?number1:number2;
min=number1>number2?number2:number2;
return(max);
return(min);
}
C语言帮忙找出下列各段程序中的语法和逻辑错误.main(){int num1,num2;printf("Please enter two numbers:");scanf("%d%d",&num1,&num2);printf("Max=%d,Min=%d\n",max_min(int num1,int numb2));}int max_min(number1,number2){int max,min;max=nu
main()
{
int num1,num2;
printf("Please enter two numbers:");
scanf("%d%d",&num1,&num2);
printf("Max=%d,Min=%d\n",max_min(int num1,int numb2)); //里面是函数调用吗?看着有点象是声明啊,调用实参不用加类型名吧
}
int max_min(number1,number2) //形参没定义类型
{
int max,min;
max=number1>number2?number1:number2;
min=number1>number2?number2:number2;
return(max);
return(min); //返回值只能有1个,第二个执行不到的
}
改:将输出改在函数中,避免只能返回一个值的问题
main()
{
void max_min(int num1,int numb2);//声明函数
int num1,num2;
printf("Please enter two numbers:");
scanf("%d%d",&num1,&num2);
max_min(num1,numb2);
}
void max_min(int number1,int number2)
{
int max,min;
max=number1>number2?number1:number2;
min=number1>number2?number2:number2;
printf("Max=%d,Min=%d\n",max,min);
}