In this program, You will learn how to use Different Formats of type casting and display the converted values in C++.
int x = 10;
char ch = char(x);
#include<iostream>
using namespace std;
int main() {
int a = 66;
float f = 3.4;
double d = 67.89;
char c = 'd';
cout << " int in char Format is :" << char(a);
cout << "\n float in int Format is :" << int(f);
cout << "\n double in char Format is :" << char(d);
cout << "\n char in int Format is :" << int(c);
return 0;
}
int in char Format is :B
float in int Format is :3
double in char Format is :C
char in int Format is :100