Lesson 74: Input, Output and Assignment Instructions

Input

Reading data from the user or a file uses functions such as scanf() or cin in C++. For example, scanf("%d", &x) reads an integer from the user and stores it in the variable x.

Output

Displaying data to the screen or a file uses functions such as printf() or cout in C++. For example, printf("%d", x) displays the value of the variable x on the screen.

Assignment

Storing a value in a variable uses the assignment operator (=). For example, x = 5 assigns the value 5 to the variable x.

Leave a comment

Your email address will not be published. Required fields are marked *

sponsors Ads