error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘

简介: error C2449: found ‘{‘ at file scope (missing function header?)和error C2059: syntax error : ‘}‘
#include <stdio.h>
// 用模块化程序设计的思想编写一个程序,求三位同学英语课的平均成绩并显示在屏幕上。
double ping(double num1, double num2, double num3);
int main(void)
{
double num1, num2, num3;
printf("请输入三位同学的英语成绩:");
scanf("%lf %lf %lf", &num1, &num2, &num3);
printf("三位同学的平均成绩是: %.2f", ping(num1, num2, num3));
return 0;
}
-----------------------------------------------------------------------------------
double ping(double num1, double num2, double num3);
原因在于这里定义函数时是不需要在其后面加上分号;
加上之后后面的{}的内容成为了流浪汉--没人要
解决方法:删除函数头部末尾的分号
注意函数的原型声明需要加上分号
-----------------------------------------------------------------------------------
{
return (num1 + num2 + num3)/3;
}


目录
相关文章
|
29天前
|
Java Windows
【Azure Function】部署Java Function失败:报错deploy [ERROR] Status code 401和警告 'China North 3' may not be a valid region
1:deploy [ERROR] Status code 401, (empty body). 2: China North 3 may not be a valid region,please refer to https://aka.ms/maven_function_configuration#supported-regions for values. 3:  <azure.functions.maven.plugin.version>1.36.0</azure.functions.maven.plugin.version>
34 11
|
6月前
|
Python
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
|
6月前
【Azure 应用服务】Azure Function 启用 Managed Identity后, Powershell Funciton出现 ERROR: ManagedIdentityCredential authentication failed
【Azure 应用服务】Azure Function 启用 Managed Identity后, Powershell Funciton出现 ERROR: ManagedIdentityCredential authentication failed
|
7月前
|
前端开发
Error in created hook: “TypeError: _test.default is not a function
Error in created hook: “TypeError: _test.default is not a function
Fatal error: Call to undefined function openssl_pkey_get_private()
Fatal error: Call to undefined function openssl_pkey_get_private()
88 0
|
9月前
|
Go
Error: Package awesomeProject contains more than one main function Consider using File kind instead
Goland编辑器运行时出现“edit configuration”窗口,阻碍代码执行。解决方法:右键点击源文件运行。问题源于Go语言不支持函数重载,同一包内不能有两个同名函数,导致多入口冲突。初学者在main包中使用了多个Go源文件,应改为仅有一个源码文件来避免此问题。
83 0
|
9月前
|
计算机视觉 Python
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
199 0
|
人工智能 自然语言处理 小程序
cloud function service error code -501000, error message 找不到对应的FunctionName.; at cloud.callFunction
cloud function service error code -501000, error message 找不到对应的FunctionName.; at cloud.callFunction
103 0
|
编译器 C语言
__FILE__, __LINE__ __FUNCTION__
__FILE__, __LINE__ __FUNCTION__
|
JavaScript Cloud Native Go
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
91 0

热门文章

最新文章