鱼C论坛

 找回密码
 立即注册
查看: 2724|回复: 4

[已解决]请问大佬

[复制链接]
发表于 2021-3-16 17:06:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#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");
}
请问大佬们上面哪错了啊,我是跟着第一个视频一起打的啊,为什么会提示有错误啊。
十分感谢。
最佳答案
2021-3-16 17:15:53
本帖最后由 jackz007 于 2021-3-16 17:18 编辑
  1. #include <stdio.h>
  2. #include <math.h>

  3. void main()
  4. {
  5.         double x, s;

  6.         printf("input number:\n")             ;
  7.         scanf("%lf", &x)                      ; // "%lf" 的 'l' 不是数字字符 1,而是字母 "L" 的小写
  8.         s = sin(x)                            ;
  9.         printf("sin of %1f is %lf\n" , x , s) ; // 不可以把输入参数 x , s 也写进格式描述字符串,"%lf" 的 'l' 不是数字字符 1,而是字母 "L" 的小写
  10. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-3-16 17:15:10 | 显示全部楼层
改好了,还有,请去学新版C教程
  1. #include <stdio.h>
  2. #include <math.h>

  3. int main()
  4. {
  5.     double x, s;

  6.     printf("input number:\n");
  7.     scanf("%lf", &x);
  8.     s = sin(x);
  9.     printf("sin of %.1lf is %.1lf\n", x, s);
  10.     return 0;
  11. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-3-16 17:15:53 | 显示全部楼层    本楼为最佳答案   
本帖最后由 jackz007 于 2021-3-16 17:18 编辑
  1. #include <stdio.h>
  2. #include <math.h>

  3. void main()
  4. {
  5.         double x, s;

  6.         printf("input number:\n")             ;
  7.         scanf("%lf", &x)                      ; // "%lf" 的 'l' 不是数字字符 1,而是字母 "L" 的小写
  8.         s = sin(x)                            ;
  9.         printf("sin of %1f is %lf\n" , x , s) ; // 不可以把输入参数 x , s 也写进格式描述字符串,"%lf" 的 'l' 不是数字字符 1,而是字母 "L" 的小写
  10. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-3-16 20:39:06 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-3-16 20:39:48 | 显示全部楼层
qiuyouzhi 发表于 2021-3-16 17:15
改好了,还有,请去学新版C教程

谢谢大佬!
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-26 05:26

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表