Exercise: Declaration and Initialization Of Data Types
Test your understanding of data types and initialization of declared variables in C++
We'll cover the following
Problem Statement
You have been given a task to perform a list of variable declarations, assigning values and printing the output on the console. Here are the types of declarations we need to perform:
Declare an
integer
type variable nameintNumber
and assign it a value of30
.Declare a
float
type variable namefloatNumber
and assign it a value of30.78
.Declare a
double
type variable namedoubleNumber
and assign it a value of45.1234
.Declare a
bool
type variable nameboolean
and assign it a value oftrue
.Declare a
char
type variable namecharName
and assign it a value ofu
.Lastly, print the values of all declared variables.
Expected output
At the end, your program should be able to display the following output:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy