Skip to Main Content
Fundamentals of Computer Programming and IT by Pearson
book

Fundamentals of Computer Programming and IT by Pearson

by Ashok Namdev Kamthane, Rohit Khurana
May 2024
Intermediate to advanced content levelIntermediate to advanced
577 pages
22h 34m
English
Pearson India
Content preview from Fundamentals of Computer Programming and IT by Pearson
286 Fundamentals of Computer Programming and IT
Write a program to use different formats of typecasting and display the converted values.
# include <iostream.h>
# include <conio.h>
void main()
{
int a=66;
float f=2.5;
double d=85.22;
char c=’K’;
clrscr();
cout <<“\n int in char format : “<<(char)a;
cout <<“\n float in int format : “<<(int)f;
cout <<“\n double in char format : “<<(char)d;
cout <<“\n char in int format : “<<(int)c;
}
OUTPUT:
int in char format : B
float in int format : 2
double in char format : U
char in int format : 75
Explanation
In the above program, the variables of int, float, double and char type are declared and initialized.
The variable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Basic Computer Engineering (Subject Code: BE - 205)  by Pearson

Basic Computer Engineering (Subject Code: BE - 205) by Pearson

Anita Goel, Anand Motwani

Publisher Resources

ISBN: 9781299447479