summaryrefslogtreecommitdiffstats
path: root/src/chapter1/lesson5/multiple_cin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chapter1/lesson5/multiple_cin.cpp')
-rw-r--r--src/chapter1/lesson5/multiple_cin.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/chapter1/lesson5/multiple_cin.cpp b/src/chapter1/lesson5/multiple_cin.cpp
new file mode 100644
index 0000000..991e397
--- /dev/null
+++ b/src/chapter1/lesson5/multiple_cin.cpp
@@ -0,0 +1,14 @@
+#include <iostream> // for std::cout and std::cin
+
+int main()
+{
+ std::cout << "Enter two numbers separated by a space: ";
+
+ int x{}; // define variable x to hold user input (and value-initialize it)
+ int y{}; // define variable y to hold user input (and value-initialize it)
+ std::cin >> x >> y; // get two numbers and store in variable x and y respectively
+
+ std::cout << "You entered " << x << " and " << y << '\n';
+
+ return 0;
+}