diff options
| author | s1n <[email protected]> | 2019-11-27 22:57:39 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-11-27 22:57:39 -0800 |
| commit | 2d74950cf107daa391dba6f483a390e57c60dd0b (patch) | |
| tree | 3574985152c31ba2b9a97ad4d1f33c0b5bc0e206 /cpp-adding/src/main.cpp | |
| parent | Initial commit (diff) | |
| download | cpp-examples-2d74950cf107daa391dba6f483a390e57c60dd0b.tar.xz cpp-examples-2d74950cf107daa391dba6f483a390e57c60dd0b.zip | |
Add files via upload
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;
+}
|