...

/

Solution Review: Convert Double Value into Integer

Solution Review: Convert Double Value into Integer

Let's see the detailed solution review of the challenge given in the previous lesson.

We'll cover the following...

Solution #

Press + to interact
#include <iostream>
using namespace std;
int main() {
// Initialize a variable of type double
double double_value = 70.968;
// Prints value of variable
cout << "double_value = " << double_value << endl;
// Declare a variable of type int
int integer_value;
// Assign double value to variable of integer type
integer_value = double_value;
// Prints value of variable
cout << "integer_value = " << integer_value;
}
...