# C++ Programming Example of Basic Input and Output stream objects

## Description:

C++ Programming Example- in this article we discussed the most important and commonly used examples in c++.

## cin C++ Stream object Programming Examples:

Output:

Output:

Output:

### Example write a program that inputs the name, age, height and gender of a student using ‘cin C++ stream object’:

#### Flow chart: #### Program: ### Example write a program that inputs distance in miles from user and converts miles into kilometers. One mile =1.609 kilometer using cin cout stream objects: ### Example write a program in C++ to converts pound into kilograms using cin cout stream objects:

1 pound = 0.453592 ### Example write a program in C++ which convert Inches to centimeters using cin cout stream objects:

1 inch = 2.54 centimeters ### Example writes a program in C++ to calculate the volume and surface area of a sphere using cin cout stream objects:

Formula:

area of sphere = 4π R2
circumference f sphere = 4/3 πR3
the value of π is = 3.1417 ### Example write a program in C++ which calculate the area and circumference of the circle using cin cout stream objects:

Formula:

area of circle = π R2
circumference of circle= 2πR
the value of π is = 3.1417

#### Flowchart:  ### Example write a temperature program in C++ which converts the Fahrenheit to Centigrade using cin cout stream objects:

C=5/9(F-32)

#### Flowchart:  ### Example write a program that inputs marks obtained by a student in five different subject and find out aggregate marks (total marks) and percentageusing cin cout stream objects: ### Example write a program that inputs the value of three sides of a triangle and finds out its areausing cin cout stream objects:

Formula:  ### Example write a program which consists of three variable Area, Perpendicular, and Base. The program inputs the values in variables per and base from the user and computes the area of a triangleusing cin cout stream objects:

Formula:

Area = (base*per)/2 ### C++ Programming Example: write a program in C++ which reverse the order of the long numbersusing cin cout stream objects: ### C++ Programming Example: Write a program that inputs the current price of gas and electricity per unit. Give each item’s rate with an increment of 20%. The program computes the new price of gas and electricity using cin cout stream objects: ### C++ Programming Example: write a program which calculate the employee dearness allowance, medical allowance, house rent allowance and calculate the gross salary and displayusing cin cout stream objects:

25% dearness allowance.

15% medical allowance.

45% house rent allowance.

formula:

gross salary= basic pay + dearness allowance + medical allowance + house rent. ## The ‘cout’ C++ Stream Object Programming Examples:

### C++ Programming Example: write a program that computes and display the area of a square. The formula to compute the area of square isusing cout stream object:

Area = height * width;

#### Flowchart:  It the above program “Area of square =” is a text message. The text message will be displayed first and the value of variable ‘area’ will be displayed.

### C++ Programming Example: write a program that adds two floating point values and displays the sum on the screenusing cout stream object: ### C++ Programming Example: write program that converts 45.6 centigrade temperature into Fahrenheit using the formula F=9/5(C+32) and displays the temperature in Fahrenheitusing cout stream object: ### C++ Programming Example: write a program which convert age in moths and daysusing cout stream object: ### C++ Programming Example: write a program that displays values of integer, floating point variable and character variable on the screenusing cout stream object: ### C++ Programming Example: write a program that calculates the distance covered by a body in 20.5 seconds. The initial velocity of body is 15.8 meter per second and acceleration is 10.2m/sec2using cout stream object:

Formula:

S=vit+1/2at2 ## Related article:

Friend Function And Friend Class In C++ With Examples