Assignment 1: Revision on C++
Objectives
- Creating variables.
- Using arithmetic operations on variables.
- Using control statements: If, else if, else, while, for, switch-case.
- Simple functions
- Make custom namespace
Prerequisites (Before you start)
- Required: Read the notes of the first week: [Part 1: C++ Basics] .
Grading
- This part constitutes 40% of the week grades.
- Grading per line.
- +20% bonus.
Deadline
Monday 18/2/2019 11:59 PM.
Writing Your First C++ Basics
- First, register yourself for the assignment from this link.
then,
then,
- Clone the remote repository to your local machine.
- Jump to the assignment folder and open the
main.cpp
file. - You will find the questions as in-line comments. Questions
P1
andP3
are solved for you to be more familir. - If you feel uncomfortable with any question, do not panic, you can ask for explanation at office hours before deadline.
Important notes
How to compile my source code
After you attempt all problems, open the terminal on the task folder. Make sure you are on the right directory by listing the files and finding main.cpp
file.
$ ls
main.cpp
To compile, you need to introduce to your compiler the main.cpp
and the executable name (which is an arbitrary name)
$ g++ main.cpp -o app
To run,
$ ./app
🎉🎉🎉
About submitting
- As you did in first part, after solving problems, save the file, then commit and push.
$ git commit -a -m "solved all problems, where is my GitHub sticker?!"
$ git push origin master
- You can push all solutions with a single
commit
and a singlepush
. -
You can also solve each problem separately and
commit
andpush
for each problem you solve:- So you practice yourself with
git
commands. - So you realize some significance of using
git
to work on large projects.
- So you practice yourself with