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++ for else 
Cpp :: arduino funktion 
Cpp :: c++ program transpose of matrix 
Cpp :: convert string to lpwstr 
Cpp :: vector size for loop 
Cpp :: delete specific row from dynamic 2d array c++ 
Cpp :: array max and minimum element c++ 
Cpp :: hamming distance c++ 
Cpp :: c++ get type name of object 
Cpp :: C++ structure (Struct) 
Cpp :: stoi cpp 
Cpp :: cin.getline 
Cpp :: C++ Structures (struct) 
Cpp :: int max c++ 
Cpp :: could not find the task c c++ active file 
Cpp :: sort a vector c++ 
Cpp :: how to check a number in string 
Cpp :: quick sort c+++ 
Cpp :: bubblesort c++ 
Cpp :: char to integer c++ 
Cpp :: c++ namespace 
Cpp :: string search c++ 
Cpp :: doubly linked list in cpp 
Cpp :: macros in c++ 
Cpp :: cpp lambda function 
Cpp :: joining two vectors in c++ 
Cpp :: best time to buy and sell stock leetcode solution 
Cpp :: log base 2 in c++ 
Cpp :: cpp get exception type 
Cpp :: c++ insert variable into string 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =