- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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