如何纠正呼叫到非功能错误

如何纠正呼叫到非功能错误

本文介绍了如何纠正呼叫到非功能错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include<stdio.h>
float avg(float marks);
float percent(float marks,float total);
void main()
{
 float marks,s1,s2,s3,s4,s5,average,percentage;
 float total=500.0;

 printf("Enter the marks in five subjects");
 scanf("%f%f%f%f%f",&s1,&s2,&s3,&s4,&s5);
 marks=s1+s2+s3+s4+s5;

 average=average(marks);//says its a call to non function pls clarify//
 printf("%fAverage marks is",average);
 percentage = percent(marks,total);
 printf("%fPercentage marks is",percentage);
}
float average(float marks)
{
 float avg;
 avg=marks/5.0;
 return avg;
}
float percent(float marks,float total)
{
float p;
p=marks/total*100;
return p;
}

推荐答案

#include<stdio.h>
float compute_average(float marks);
float compute_percent(float marks,float total);
int main()
{
 float marks,s1,s2,s3,s4,s5,average,percentage;
 float total=500.0;

 printf("Enter the marks in five subjects");
 scanf("%f%f%f%f%f",&s1,&s2,&s3,&s4,&s5);
 marks=s1+s2+s3+s4+s5;

 average=compute_average(marks);//says its a call to non function pls clarify//
 printf("Average marks is %f\n",average);
 percentage = compute_percent(marks,total);
 printf("Percentage marks is %f\n",percentage);

 return 0;
}
float compute_average(float marks)
{
 float avg;
 avg=marks/5.0;
 return avg;
}
float compute_percent(float marks,float total)
{
float p;
p=marks/total*100;
return p;
}


#include<stdio.h>
float average(float marks);
</stdio.h>



应该可以解决问题。


should do the trick.


这篇关于如何纠正呼叫到非功能错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 16:27