From 2d74950cf107daa391dba6f483a390e57c60dd0b Mon Sep 17 00:00:00 2001 From: s1n Date: Wed, 27 Nov 2019 22:57:39 -0800 Subject: Add files via upload --- cpp-adding/src/main.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 cpp-adding/src/main.cpp (limited to 'cpp-adding/src/main.cpp') 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 +#include // 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; +} -- cgit v1.2.3