Practical work
1. Write a program in C++ to print a welcome text in a separate line.
2. Write a program in C++ to print the sum of two numbers. Print the sum of two numbers : The sum of 29 and 30 is : 59
3.
Write
a program in C++ to find Size of fundamental data types.
Sample Output:
Find Size of fundamental data types
:
The sizeof(char) is : 1 bytes
The sizeof(short) is : 2 bytes
The sizeof(int) is : 4 bytes
The sizeof(long) is : 8 bytes
The sizeof(long long) is : 8
bytes
The sizeof(float) is : 4 bytes
The sizeof(double) is : 8
bytes
The sizeof(long double) is : 16
bytes
The sizeof(bool) is : 1 bytes
4. Write a program in C++ to print the sum of two
numbers using variables.
Print the sum of two numbers :
The sum of 29 and 30 is : 59
5. Write a program in C++ to check the upper and
lower limits of integer.
Expected Output:
Check the upper and lower limits of
integer :
--------------------------------------------------
The maximum limit of int data type :
2147483647
The minimum limit of int data type :
-2147483648
The maximum limit of unsigned int
data type : 4294967295
The maximum limit of long long data
type : 9223372036854775807
The minimum limit of long long data
type : -9223372036854775808
The maximum limit of unsigned long
long data type : 18446744073709551615
The Bits contain in char data type :
8
The maximum limit of char data type
: 127
The minimum limit of char data type
: -128
The maximum limit of signed char
data type : 127
The minimum limit of signed char
data type : -128
The maximum limit of unsigned char
data type : 255
The minimum limit of short data type
: -32768
The maximum limit of short data type
: 32767
The maximum limit of unsigned short
data type : 65535
6. Write a program in C++ to check whether the
primitive values crossing the limits or not.
Check whether the primitive values
crossing the limits or not :
--------------------------------------------------------------------
The Gender is : F
Is she married? : 1
Number of sons she has : 2
Year of her appointment : 2009
Salary for a year : 1500000
Height is : 79.48
GPA is 4.69
Salary drawn upto : 12047235
Balance till : 995324987
7.
Материалы на данной страницы взяты из открытых источников либо размещены пользователем в соответствии с договором-офертой сайта. Вы можете сообщить о нарушении.