#include<stdio.h>
#include<math.h>
void main()
{
float a,b,c,S;
float area;
printf("Enter sides of triangle ");
scanf("%f%f%f",&a,&b,&c);
S=(a+b+c)/2;
area=sqrt(float (S(S-a)(S-b)(S-c)));
printf("Area of triangle is %f ",area);
getch();
}
我在这里遇到了一些错误我无法取消此代码是错还是其他任何问题或需要进行任何修改? 我知道这太简单了,但我仍然坚持不懈。
错误是这样的:
1>------ Build started: Project: sample project, Configuration: Debug Win32 ------
1>Build started 09-Jul-15 10:58:26 AM.
1>InitializeBuildStatus:
1> Touching "Debug\sample project.unsuccessfulbuild".
1>ClCompile:
1> sample project.cpp
1>c:\users\aaveg\documents\visual studio 2010\projects\sample project\sample project\sample project.cpp(8): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
1>c:\users\aaveg\documents\visual studio 2010\projects\sample project\sample project\sample project.cpp(10): error C2064: term does not evaluate to a function taking 1 arguments
1>c:\users\aaveg\documents\visual studio 2010\projects\sample project\sample project\sample project.cpp(12): error C3861: 'getch': identifier not found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.35
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========*/