W4-Module-Problem Solving Through
W4-Module-Problem Solving Through
W4-Module-Problem Solving Through
After undergoing the trouble of listing what needs to be done and visualizing
the flow of your solution, what is next to do? It is to implement them as
designed. To do that, you will need an environment to do so. Environments
are essential to accomplish things. Human have Earth to live in. Programs
have the Computer to run into. But how about the source codes? We store
them into individual files.
What are we waiting for? Let us continue our exploration of the world of
Computer Programming.
Course Module
Recall
Introduction
When we talk about environments, we deal with all that is needed for
software development. We are not limited to IDEs only. We also include the
operating system where we will be storing our files. We also include the
compilers that will eventually compile our source codes. And much more. Let
us do this!
Operating System
Figure 1. Griffin, A. (2015). Windows 10 Free: Why is Microsoft Giving Away Its New Operating
System? And Who’s Losing Out? [Online Blog]. Retrieved from http://www.independent.co.uk/life -
style/gadgets-and-tech/news/windows-10-free-why-is-microsoft-giving-away-its-new-operating-
system-and-who-s-losing-out-9995492.html#gallery
For this course, we will be using Microsoft Windows as our operating system.
Majority of users use Microsoft Windows as their operating system because
of its user-friendly interface and easy navigation. Aside from that, the power
that Windows deliver to the user is tremendous. Majority of configurations
are available for the users to exploit and manage. As for the security, vast
access control and file management is available and easy to configure.
You may also try using any distribution of Linux operating system like Ubuntu
and Fedora in writing and compiling your C++ source codes. However, this
course will only cover Microsoft Windows. The setup and installation process
may vary, however IDE configuration and setup will virtually be the same.
Course Module
Figure 2. Visual Studio Code
Our choice of IDE for this course is the Visual Studio Code (VSCode) of
Microsoft. Visual Studio Code is the latest iteration of Microsoft Visual Studio
series available for free. It is a lightweight IDE which means it uses minimal
storage size and RAM resources. It supports a variety of programming
languages like C++, C#, JavaScript, Python and PHP. This IDE supports syntax
highlighting, intellisense, plugins, and file system organization. Visual Studio
Code is available for Windows, MacOS and Linux.
Compilers
Version Control
Now that we have a list of tools that we minimally need to develop our very
first C++ application, we need to secure a version control for our files.Version
Control is a way to organize the development files and configurations in a
centralizedrepository. Having version control for small projects are optional
considering the low number of files that are processed, however this course
will make use of version control to allow you to revert and secure copies of
changes that you will commit to the repository, and build your initial
reputation in the Open Source Community.
Course Module
Figure 4. MicroEJ. (2015). MicroEJ and Github [Online Blog].
Retrieved from http://www.microej.com/microej-and-github/
We will be using the Open Source Community’s most famous and most used
online version control repository since 2016, the Github. Github is a free and
public web-based repository that allows distributed version control and
source control management tool that uses extended Git functionalities. The
repositories for Github are public for free users which we will exploit for this
course.
Microsoft has its own version control repository for Open Source projects called
CodePlex which tried to be in par with Github. CodePlex was made to allow
developers in the Open Source Community to publicly share software.
In this section, we will install, setup and configure the tools that we will use
for the development. Let us get started!
We will start with creating our very first Github account. If you already have
an existing account, you may use that account and skip to the next
subsection.
1. Visit the GitHub, Inc. website through the link https://github.com/.
2. Click the “Sign up” link on the upper right corner of the page.
3. For Step 1:
a. Enter your preferred username, valid and active email address,
and password.
b. Click “Create an account” button.
4. For Step 2:
a. Select “Unlimited public repositories for free”.
b. Leave the “Help me set up an organization next” checkbox
unticked.
c. Click “Continue” button.
5. For Step 3:
a. Select the most appropriate options you desire. This course
will not limit you on how you will use your GitHub account in
the future.
b. Click “Submit” button.
6. You are now ready to create your first GitHub project.
Course Module
Figure 6. Week004 Initial Github Repository
Now that we have our GitHub account, we need to create a repository for this
week’s configurations. The initial steps might differ depending if you already
have created repositories in the past, or if this will be your very first GitHub
repository.
Course Module
Downloading Visual Studio Code
Next we need to install our IDE, the Visual Studio Code. Follow the steps
below with ease.
Now that we have our IDE installed, we need to install our complier next. To
begin, we will need to download a version of MinGW. It is best practice to
download the latest stable build of MinGW for 32-bit Windows.
Course Module
Figure 10. MinGW Installation Manager Setup
Compared to the rest of the setup, this installation process will take several
steps to complete. This is mainly because of how MinGW was designed. It
focuses on Native libraries hence even its Graphical User Interface (GUI) is
made using Native Windows Application.
1. Press the “[Windows Logo] Windows” and the “Pause” keys at the
same time. This will open the Windows System window.
2. Click the “Advanced System Settings” link on the left pane of the
window to open the System Properties dialog.
3. Click the “Environment Variables…” button.
4. Under system variables, locate and select the “Path” variable.
5. Click the “Edit” button.
6. Add MinGW’sBin folder as entries:
a. For Windows 10:
i. Click the “New” button.
ii. Enter “C:\MinGW\bin” in the textbox.
iii. Click the “OK” button.
b. For Windows 8.1 and earlier versions:
i. Verify that the “Path” value is displayed in the “Variable
name” textbox.
ii. In the “Variable value” textbox, add the following lines
without the quotations: “;C:\MinGW\bin;” (take note of the
semi-colons placed in front and at the backof the file path.)
iii. Click the “OK” button.
7. Click the “OK” button.
8. Click the “OK” button to close the System Properties dialog.
9. Close the Windows System window.
10. To test if you correctly performed the steps:
a. Open a command prompt.
b. Enter “g++ --version”.
c. Verify that the “g++ (GCC) 5.3.0” is displayed.
Since we have installed all necessary tools and utilities to develop C++
applications, let us now setup our project directory.
Lastly, we need to install the C/C++ Extension for Visual Studio to support C
and C++ applications.
1. Open Visual Studio Code.
2. Click the “Extension (CTRL+SHIFT+X)” icon on the left pane.
3. Enter “C/C++” in the textbox. A list of extensions will be displayed that
supports C/C++.
4. Select the first item with “C/C++” purple icon.
5. Click the “Install” icon of the “C/C++” extension.
Week 004 - Hello World
Now that we have setup our work environment, tools, utilities and
configurations to write, run and debug a C++ application, we will now work
on our very first Hello World application.
Course Module
1. In the code, under the TO DO comments, add the line: cout << “Hello
World”;
2. This is case-sensitive. Do not capitalize any part of the line outside of
the quotation marks. The line ends with a semi-colon (;).
Build and run our application.
1. Click the “Debug (CTRL+SHIFT+D)” icon.
2. Click the “Start Debugging“ button with a green play icon.
Notice that in the console, the words “Hello World” are displayed.
You have successfully created your very first application using C++!
Glossary
Course Module