C++教程
C++控制语句
C++函数
C++数组
C++指针
C++对象
C++继承
C++多态
C++抽象
C++常用
C++ STL教程
C++迭代器
C++程序

C++ Math llround()

C++ Math llround()

此函数用于舍入给定值并将其转换为long long整数。

语法

假设数字是" x"。语法为:
long long int llround(data_type x);

参数

x : 该值可以是double或float。

返回值

它返回x的舍入值。函数的返回类型是long long integer。

示例1

让我们看一个简单的示例。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
    float x=50.8;
    std::cout <<"The value of x is :" <<x<< std::endl;
    std::cout << "The rounded value of x is :"<<llround(x) << std::endl;
    return 0;
}
输出:
The value of x is :50.8
The rounded value of x is :51

昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4