double to float c++
double v1 = 20120313.0;
float v2 = (float) v1;
double to float c++
double v1 = 20120313.0;
float v2 = (float) v1;
C++ float and double simple example
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
// Creating a double type variable
double a = 3.912348239293;
// Creating a float type variable
float b = 3.912348239293f;
// Printing the two variables
cout << "Double Type Number = " << a << endl;
cout << "Float Type Number = " << b << endl;
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us