diff options
Diffstat (limited to 'cpp-adding/src/main.cpp')
| -rw-r--r-- | cpp-adding/src/main.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cpp-adding/src/main.cpp b/cpp-adding/src/main.cpp new file mode 100644 index 0000000..6051ef1 --- /dev/null +++ b/cpp-adding/src/main.cpp @@ -0,0 +1,30 @@ +// TODO: firstNumber and secondNumber are entered on two different lines, then calculated into sumOfTwoNumbers.
+
+#include <iostream>
+#include <conio.h> // For restart function
+using namespace std;
+
+// If you really wanted to you could put all of the logic into main(), but I just like to keep it like this so it looks nice and tidy.
+int Logic()
+{
+ int firstNumber, secondNumber, sumOfTwoNumbers;
+
+ cout << "Enter two numbers: ";
+ cin >> firstNumber >> secondNumber;
+
+ // Temp. variable storage
+ sumOfTwoNumbers = firstNumber + secondNumber;
+
+ // Prints sumOfTwoNumbers
+ cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers << endl;
+
+ return 0;
+};
+
+int main()
+{
+ Logic();
+ system("pause");
+
+ return 0;
+}
|