diff options
Diffstat (limited to 'cpp-adding')
| -rw-r--r-- | cpp-adding/README.md | 59 | ||||
| -rw-r--r-- | cpp-adding/src/main.cpp | 30 |
2 files changed, 89 insertions, 0 deletions
diff --git a/cpp-adding/README.md b/cpp-adding/README.md new file mode 100644 index 0000000..d9551de --- /dev/null +++ b/cpp-adding/README.md @@ -0,0 +1,59 @@ +``` + ___ _ _ _ + / _ \ | | | (_) +/ /_\ \ __| | __| |_ _ __ __ _ +| _ |/ _` |/ _` | | '_ \ / _` | +| | | | (_| | (_| | | | | | (_| | +\_| |_/\__,_|\__,_|_|_| |_|\__, | + __/ | + |___/ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``` + +<!-- ABOUT THE PROJECT --> +## About The Project + +Adding in C++. + + + +<!-- GETTING STARTED --> +## Getting Started + +[Clone or download](https://github.com/8cy/cpp-adding) the project and run in your favourite choice of [IDE](https://en.wikipedia.org/wiki/IDE) or [Text Editor](https://en.wikipedia.org/wiki/Text_editor) with a Code Runner. + +> *[Code Runner](https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner) by [Jun Han](https://marketplace.visualstudio.com/publishers/formulahendry) on the [VSCode Marketplace](https://marketplace.visualstudio.com/) is my Code Runner of choice but you can feel free to use anything that works for you.* + +### Prerequisites + +This is an example of how to list things you need to use the software and how to install them. +* Your favourite C++ Compiler + + + +<!-- CONTRIBUTING --> +## Contributing + +Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. + +1. Fork the Project +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the Branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request + + + +<!-- LICENSE --> +## License + +Distributed under the MIT License. See [`LICENSE`](/LICENSE) for more information. + + + +<!-- CONTACT --> +## Contact + +s1nical - [@s1nical](https://twitter.com/s1nical) - [email protected] + +Project Link: [https://github.com/8cy/cpp-adding](https://github.com/8cy/cpp-adding) 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;
+}
|