首页
比赛
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
牛牛学说话之-浮点数
151条解析
开通博客写题解
牛客881689734号
发表于 2022-02-18 20:29:55
首先浮点数有:float和double; C语言的格式是: int main() { return 0; } 输出函数是:printf(“”);但需要激活它,激活的办法就是在开头写#include<stdio.h> 输入函数是:scanf(“......”,&...); 最
展开全文
kkk03
发表于 2023-08-06 14:49:31
c++中浮点数有:float和double;c++中浮点数有:float和double;c++中浮点数有:float和double; #include<bits/stdc++.h> using namespace std; double a; int main() { cin>&
展开全文
iwzan
发表于 2022-03-07 13:53:58
#include<stdio.h> int main(){ float i; scanf("%f",&i); pri
展开全文
八十岁的少女
发表于 2022-02-22 14:04:08
#round函数会四舍五入的把0吞掉 #a = input() #b = round(float(a),3) #print(b) a = input() print(format(float(a), '.3f'))
xiaominen
发表于 2022-03-09 16:51:23
#include <iostream> #include <iomanip> using namespace std; int main() { float x; cin >> x; cout << fixed <<
展开全文
范特西的龙
发表于 2022-02-20 20:02:34
public class Main { public static void main(String[] args){ float a; Scanner a1=new Scanner(System.in); a=a1.nex
展开全文
张田懿
发表于 2020-12-08 10:38:01
include<bits/stdc++.h> using namespace std;int main(){ double a; cin>>a; printf("%.3f",a); return 0;}
你闭着眼
发表于 2022-03-05 19:44:52
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner input = new Scanner(System.in); float num = input.nextFlo
展开全文
不错就是对
发表于 2022-03-23 14:42:28
BC4 牛牛学说话之-浮点数 思路: 该题不能使用round()函数,因为这样会吞0;故使用format(n,'.Xf') step1:输入浮点数,然后使用format(n,'.Xf') 代码如下: n = float(input()) print(format(n,'.3f'))
WangWangBing
发表于 2021-04-11 09:13:41
include<iostream> include<iomanip> using namespace std; int main() { float x; cin>>x; cout<<setprecision(2)<<x<
展开全文
查看本题
查看本题讨论
相关比赛
18201-2021暑假准大一生编程练习1
进入比赛
18202-test
进入比赛
18212-2021暑假准大一生编程练习一
进入比赛
18656-21届FPA暑期练习
进入比赛
18839-牛客竞赛语法入门班顺序结构习题
进入比赛
等你来战
查看全部
第五届上海理工大学程序设计全国挑战赛
报名截止时间:2025-06-28 17:30
牛客周赛 Round 98
报名截止时间:2025-06-29 21:00
牛客小白月赛119
报名截止时间:2025-07-04 21:00
牛客周赛 Round 99
报名截止时间:2025-07-06 21:00
牛客练习赛142
报名截止时间:2025-07-11 21:30
牛客周赛 Round 100
报名截止时间:2025-07-13 21:00
2025牛客暑期多校训练营1
报名截止时间:2025-07-15 17:00
2025牛客暑期多校训练营2
报名截止时间:2025-07-17 17:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题