庸善德 发表于 2018-1-23 10:19:04

新手求助 为什么C语言基础代码打不对

#include <stdio.h>
#include <math.h>

void main()
{
        double x,s;
       
        printf("input number:\n")
        scanf("%1f", &x);
        s=sin(x)
        printf("sin of %1f is %1f\n",x,s);
}

我在打
      scanf("%1f", &x);
         printf("sin of %1f is %1f\n",x,s);   提示编译不了,可是我自己发现不了哪里有打错的地方,请指教。

C:\Users\wb-xy217071\Desktop\main.c        In function 'main':
9        2        C:\Users\wb-xy217071\Desktop\main.c        expected ';' before 'scanf'
11        2        C:\Users\wb-xy217071\Desktop\main.c        expected ';' before 'printf'
28                C:\Users\wb-xy217071\Desktop\Makefile.win        recipe for target 'main.o' failed

ba21 发表于 2018-1-23 10:21:39

庸善德 发表于 2018-1-23 10:29:54

ba21 发表于 2018-1-23 10:21


回复的好快,我在你标注的8和10的后面加了一个;就能编译成功了 谢谢
页: [1]
查看完整版本: 新手求助 为什么C语言基础代码打不对