Word Count: 66
  • Post category:C++
  • Post last modified:2023-01-11

Reference

W3School – C++ Tutorial

cout and cin

cout is used to output (print) values.

cin is a predefined variable that reads data from the keyboard with the extraction operator (>>).

int x; 
cout << "Type a number: "; // Type a number and press enter
cin >> x; // Get user input from the keyboard
cout << "Your number is: " << x; // Display the input value