![](https://csdnimg.cn/release/download_crawler_static/86373699/bg4.jpg)
5 printf("Enter three integers:");
6 scanf("%d,%d,%d",&a,&b,&c);
7 printf("\nthe maximum of them is %d\n",max(a,b,c));
8
9 printf("Enter two floating point numbers:");
10 scanf("%f,%f",&d,&e);
解答:
1)调试修改程序以使其正常运行完成指定任务:
(1) 错误修改:
1)第 1 行声明主函数前未加上头文件,正确形式为:
#include<stdio.h>
2)第 1 行声明主函数前未声明自定义函数,正确形式为:
int max (int x, int y, int z);
float sum(float x, float y);
3)第 6、10 行的 scanf 语句中%d 与%d 之间不能够加上逗号”,”,应去掉,
正确形式为:
scanf("%d%d%d",&a,&b,&c);
scanf("%f%f",&d,&e);
错误修改后源程序:
#include<stdio.h>
int max(int x, int y, int z);
float sum(float x, float y);
void main(void)
{
int a, b, c;
float d, e;