Hello again, /v/learnprogramming.
@deanmsands3 returning with part 1 of "Dean Makes an App".
Welcome back. This picks up where I left off here: https://voat.co/v/learnprogramming/2033679
Let me throw up a disclaimer: I MOSTLY know what I'm doing. I'm a CompSci graduate from a school that got most of its donations through it's Chemical Engineering department. I learned Git from 7 fast-paced months as a firmware engineer. Most of my past work has been in C, whereas these will be in C++.
So, if you have useful suggestions, I'm all ears. (Except for "Android Programming should be done in Java." Keep that one to yourself.)
Also, I really only ever implied that I'd be making a calculator with the folder name. So yeah, I'm making a calculator. For Android (eventually). In C++.
First we want to start and checkout a new branch (I only thought of this after committing.)
git checkout -b Part1
We're now in the Part1 branch.
Now the coding begins.
Create a new file (I called mine main.cpp, but it doesn't really matter, it'll change eventually).
I want to keep this basic and increase the complexity gradually (though Part2 runs an 18-wheeler right through that idea).
For now, we'll keep it simple.
You can see my "Lame CS1-Level code" at https://github.com/deanmsands3/CalculatorApp/blob/Part1/main.cpp .
This is simple code that should be easy enough for anyone with basic C++ knowledge to understand.
An operator (+, -, *, /) is entered, then two numbers. The program performs the requested operation then exits.
The program is compiled with
g++ main.cpp -o calc (if you're using GCC/G++) or
clang++ main.cpp -std=c++11 -o calc
It's run with
./calc.exe depending on your OS.
Once curiosity is satisfied, we add the code to the repo:
git add main.cpp
We can make some additions to the README.md if we like and add that too:
git add README.md
If you've set up a good ".gitignore", adding the changed files can be as simple as
git add . , but some may consider that lazy.
Now commit the code with a good message detailing your changes:
git commit -m "This is not a good message."
Lastly, we push the code to the remote. We need to do it differently since branch "Part1" doesn't exist on GitHub yet.
git push -u origin Part1
Now we merge with the master branch and push to GitHub:
git checkout master
git merge Part1
And we're done with Part 1. If you have questions or comments, leave a message.
References (New since Part 0):