Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to Read and Print an Integer value in C++
Here we will see how to read integer from user and display in C++. To take input we will use the cin operator, and to display we will use cout operator. The syntax will be like −
Input −
int x; cin >> x;
Output −
int x = 110; cout << x;
Example
#include<iostream>
using namespace std;
int main(int argc, char const *argv[]) {
int x;
int y = 50;
cout << "Enter some value: ";
cin >> x;
cout << "The given value is: " << x << endl;
cout << "The value of y is: " << y;
}
Output
Enter some value: 100 The given value is: 100 The value of y is: 50
Advertisements
