Search
 
SCRIPT & CODE EXAMPLE
 

CPP

double to int c++

double x = 5.4;
int y = (int) x;
Comment

C++ Automatic Conversion from double to int

//Working of Implicit type-conversion

#include <iostream>
using namespace std;

int main() {

   int num_int;
   double num_double = 9.99;

   // implicit conversion
   // assigning a double value to an int variable
   num_int = num_double;

   cout << "num_int = " << num_int << endl;
   cout << "num_double = " << num_double << endl;

   return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ vector allocator example 
Cpp :: how to save system function output into a variable in c++ 
Cpp :: How to execute a command and get return code stdout and stderr of command in C++ 
Cpp :: Print value of data in c++ 
Cpp :: Hash Sort in C++ 
Cpp :: last index of array c++ 
Cpp :: Equalize problem codeforces 
Cpp :: how to modify set C++ 
Cpp :: transform c++ 
Cpp :: heroatx77 
Cpp :: deliberation meaning 
Cpp :: traverse string in cpp 
Cpp :: set precision on floating numbers 
Cpp :: fsafdsfdsaf 
Cpp :: delete an dynamic array 
Cpp :: run program until ctrl-d c++ 
Cpp :: how to writte comment in c++ 
Cpp :: how to replace a element in a vector c++ using index 
Cpp :: The Three Topics codechef solution in c++ 
Cpp :: leetcode 36 c++ 
Cpp :: c++ How to not use friend declaration when equipping a class with `operator<<` 
Cpp :: # in c++ 
Cpp :: 1491. Average Salary Excluding the Minimum and Maximum Salary leetcode solution in c++ 
Cpp :: for in c++ example 
Cpp :: Arduino Access Point ESP8266 
Cpp :: csv 
Cpp :: how to get the last digit of a number 
Cpp :: (/~/+|/+$/g, ') 
Cpp :: opencv read gif c++ 
Cpp :: c++ multi-dimensional arrays 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =