#include#include using namespace std; int main() { string name; cout << "Enter your name: "; getline(cin, name); cout << "Hello, " << name << "!" << endl; return 0; }
#includeIn this example, the operator >> is used to read an integer value from the standard input stream into the integer variable num. The C++ InputStream read function is part of the iostream library in the C++ standard library.using namespace std; int main() { int num; cout << "Enter a number: "; cin >> num; cout << "You entered: " << num << endl; return 0; }