小白一只,这样打为什么会出错,求解
#include <stdio.h>#include<stdio.h>
void main()
{
doublex,s;
printf("input number:\n");
scanf("%lf",&x);
s=sin(x);
printf(sine of %lf is %lfln",x,s);
}
--------------------Configuration: Helloworid - Win32 Debug--------------------
Compiling...
Hello worid.c
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(10) : warning C4013: 'sin' undefined; assuming extern returning int
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2065: 'sine' : undeclared identifier
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : warning C4024: 'printf' : different types for formal and actual parameter 1
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2146: syntax error : missing ')' before identifier 'of'
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2001: newline in constant
执行 cl.exe 时出错.
Hello worid.obj - 1 error(s), 0 warning(s)
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, s;
printf("input number:\n");
scanf("%lf",&x);
s = sin(x);
printf(sine of %lf is %lf\n",x,s);
} 小甲鱼 发表于 2017-7-12 18:46
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, s;
printf("input number:\n");
scanf("%lf",&x);
s = sin(x);
printf(sine of %lf is %lf\n",x,s);
}
--------------------Configuration: Helloworid - Win32 Debug--------------------
Compiling...
Hello worid.c
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2065: 'sine' : undeclared identifier
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : warning C4024: 'printf' : different types for formal and actual parameter 1
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2146: syntax error : missing ')' before identifier 'of'
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2017: illegal escape sequence
E:\Microsoft Visual Studio\MyProjects\Helloworid\Hello worid.c(11) : error C2001: newline in constant
执行 cl.exe 时出错.
Hello worid.obj - 1 error(s), 0 warning(s)
额还是不对,难道我下的软件有问题{:10_266:} 56462316 发表于 2017-7-12 19:08
#include
#include
少了个双引号:
#include <stdio.h>
#include <math.h>
int main(void)
{
double x, s;
printf("input number:\n");
scanf("%lf",&x);
s = sin(x);
printf("sine of %lf is %lf\n",x,s);
} 小甲鱼 发表于 2017-7-12 19:10
少了个双引号:
感谢 一定要用#include <math.h>的预处理命令!!!!
页:
[1]