Starting Vocational Training From 1-May-2024 Get Detail


C++

Basic Input and Output
1.

Write a program in C++ to check whether a number is positive, negative or zero. 
Sample Output:
Check whether a number is positive, negative or zero :
-----------------------------------------------------------
Input a number : 8
The entered number is positive.


Solution
2.

Write a program in C++ to convert temperature in Celsius to Fahrenheit. 
Sample Output:
Convert temperature in Celsius to Fahrenheit :
---------------------------------------------------
Input the temperature in Celsius : 35
The temperature in Celsius : 35
The temperature in Fahrenheit : 95


Solution
3.

Write a program in C++ to find the Area and Perimeter of a Rectangle.
Sample Output:
Find the Area and Perimeter of a Rectangle :
-------------------------------------------------
Input the length of the rectangle : 10
Input the width of the rectangle : 15
The area of the rectangle is : 150
The perimeter of the rectangle is : 50


Solution
4.

Write a program in C++ to swap two numbers. 
Sample Output:
Swap two numbers :
-----------------------
Input 1st number : 25
Input 2nd number : 39
After swapping the 1st number is : 39
After swapping the 2nd number is : 25


Solution
5.

Write a program in C++ to display the operation of pre and post increment and decrement. 
Sample Output:
Display the operation of pre and post increment and decrement :
--------------------------------------------------------------------
The number is : 57
After post increment by 1 the number is : 58
After pre increment by 1 the number is : 59
After increasing by 1 the number is : 60
After post decrement by 1 the number is : 59
After pre decrement by 1 the number is : 58
After decreasing by 1 the number is : 57


Solution
6.

Write a program in C++ to print the sum of two numbers. 

Sample Output:
Print the sum of two numbers :
-----------------------------------
The sum of 29 and 30 is : 59


Solution