C++ Input and Output Explained for Beginners
C++ input and output is used to take data from the user and show output on the screen.
In C++, we use:
-
cin→ to take input -
cout→ to display output Example Program
#include <iostream>
using namespace std;
int main() {
int a;
cout << "Enter a number: ";
cin >> a;
cout << "You entered: " << a;
return 0;
}📌 Explanation:
-
coutprints message -
cintakes value from keyboard -
>>is insertion operator -
<<is extraction operator
-

Comments
Post a Comment