Home›Learn›C++›C++ Input and Output
C++ MASTER COURSEBEGINNER FRIENDLY

C++ Input and Output

Learn C++ Input and Output with simple explanations, practical examples, coding exercises, MCQs and interview questions.

📖 Chapter 5 / 33⏱️ 8–12 Min Read🎯 Beginner Friendly
Course Progress15%
📘

Theory

Understand the concept step by step

C++ Input and Output

C++ uses cout to display output and cin to take input from the user.

Output Using cout

cout << "Hello";

Input Using cin

int age;
cin >> age;

Example

#include <iostream>
using namespace std;

int main() {
    int age;

    cout << "Enter your age: ";
    cin >> age;

    cout << "Your age is: " << age;

    return 0;
}
💻

Example

See how the concept works in real code

Python
#include <iostream>
using namespace std;

int main() {
    int age;

    cout << "Enter your age: ";
    cin >> age;

    cout << "Your age is: " << age;

    return 0;
}
📤

Output

Expected output of the example

output
Enter your age: 21
Your age is: 21
📝

Practice

Try writing the program yourself

🎯 Practice Task

Rewrite the example program yourself without copying it. Then modify the values and observe how the output changes.

❓

MCQs

Test your understanding

❓

Quick Quiz

Test what you learned

Question 1 of 1Score: 0

What is the main topic covered in "C++ Input and Output"?

💼

Interview Questions

Prepare for C++ interviews

1. What is C++ Input and Output?+

Review the theory and example above to prepare a clear, practical answer for this question.

2. Why is C++ Input and Output important in C++?+

Review the theory and example above to prepare a clear, practical answer for this question.

3. Give a practical example of C++ Input and Output.+

Review the theory and example above to prepare a clear, practical answer for this question.

Chapter 5 of 33

Keep going — you're doing great! 🚀

15%