From 4dabc4783242417f5d5d8758cf6772e60c1665ce Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Sat, 13 May 2017 19:06:25 -0700 Subject: [PATCH] cpp: added cpp folder and io example --- cpp/io/io.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cpp/io/io.cpp diff --git a/cpp/io/io.cpp b/cpp/io/io.cpp new file mode 100644 index 0000000..36503ca --- /dev/null +++ b/cpp/io/io.cpp @@ -0,0 +1,27 @@ +#include + +//use cout and cin to print some stuff and get input + +int main(){ + /* + * All of these "<<" are going into std::cout + * the "endl" forces a flush + * note that is "l" as in "line" not "1" as in "one" + */ + std::cout << "Enter two numbers: "<< std::endl; + + int input_1; + int input_2; + input_1 = 0; + input_2 = 0; + + std::cin >> input_1 >> input_2; + + std::cout << "The numbers " + << input_1 + << " and " + << input_2 + << " add together to make " + << input_1 + input_2 + << std::endl; +}