Topic outline

    • Checklist for MO and DMO

      • Module checklist for Module Organisers Quiz
      • Module checklist for Deputy Module Organisers Quiz
    • General

      This is an introductory programming module for physicists and no prior programming knowledge is assumed.
      Students are taught the basics of imperative programming using the C++ language.
      Concepts covered include:
      •   imperative programming
      •   variables and constants
      •   flow control
      •   functions
      •   debugging
      •   pointers and references
      •   file I/O, formatted I/O
      •   use of the standard library, strings, vectors, and algorithms
      •   introduction to classes and objects

      Useful textbooks to consider are:

      McGrath, C++ Programming in easy steps

      Stroustrup, Programming: Principles and Practice using C++

      • Learning Outcomes

        Aims: By the end of this module students will be able to write, compile and run their own programs in C++. The students will be able to write programs to solve specific problems that should include common scientific procedures such as numerical data analysis, simulation, and general data file manipulation. This module aims to provide highly transferable programming skills applicable to any quantitative discipline.


        The broadest aim of this course is to convert physical problems into functioning C++ computer code.

        • To use C++ code to manipulate numerical data and calculate specific results.
        • To use C++ code to simulate physical examples by using Monte Carlo methods. 
        Disciplinary Skills
        • Master the basics elements of imperative programming: variables, flow control and functions
        • Effectively use industry standard tools for writing, testing, and running C++ code
        • Effectively use source code version control
        • To convert mathematical statements, such as functions, into C++ code.
        • To write code which prompts the user to enter variable values in order to calculate functions of these variables.
        • To write code which reads data files and manipulates the individual elements of the resulting arrays.
        • To write code which outputs data files, in appropriate formats, from arrays generated within a program
        • To write code which compares variables or array elements and whose output depends on pre determined logical statements.
        • To write code which generates random numbers within a specified distribution. 
        • Use quantitative data confidently and competently
        • Use communication technologies competently
        • Apply their analytical skills to investigate unfamiliar problems
        • Use technologies to access and interpret information effectively
        • HOMEWORK

          Reading homeworks will be posted here each week.

          There will be a test on each homework every Tuesday for Group A and every Friday for Group B

          Late submission policy for coursework:

          Section B : late submission follows the normal rules of 0 for late submissions

          Section C and D: as these are major pieces of coursework the following rules apply:

          If no homework is tagged then in the absence of other instructions (written in email) whatever is in the repository as of the deadline will be marked with a penalty applied for failing to tag as detailed on the relevant worksheet. If a tag is provided after the deadline then this tag will be marked with a 20% penalty applied per 24 hour period after the deadline. So, for example, if the deadline is Monday at noon and you submit before noon on Tuesday the penalty will be 20%.

          You will not normally be penalised for technical failures of the system outside your control.

          • Syllabus

            This module covers the basics of introductory C++ programming. The focus is on learning the basic syntax of the language, converting descriptions of operations and algorithms into code. It also covers writing, testing and debugging a larger piece of collaborative work as well as collecting and interpreting the output of the programs. This is a practical skills module and as such focuses on the uses of computers and programming to achieve practical goals rather than the theoretical underpinnings of computation and programming.

            The following topics are covered during this module:

            • the structure of a program - the main function and include statements
            • variables and types
            • Basic mathematical operations in C++
            • debugging and testing code: print statements, test code, and reading error messages!
            • flow control - looping and conditionals
            • functions - modularising and parameterising functionality
            • introduction to the STL: strings and vectors
            • Simple Input and Output: using streams to interact with the console and files
            • References - their use in function arguments
            • Classes - extending the language with new types
            • Class operators - customizing the behaviour
            • Simple random number generation and its use in simulation and modeling
            • Tools for effective programming: integrated development environments, source code version control with git and gitlab
            • Lecture notes and worksheets

              Lecture, practical session and classwork notes will appear here as the course progresses.

            • Tools and Computing

              Tools and Computing


              Some useful web links:

              JetBrains - CLion




              Link to your repository:

              Jet brains licence:

              • Schedule

                The schedule is as follows:

                Thursday 14:00 until 17:00  Bancroft 1.23 (Lecture + Quiz)

                Friday 14:00 until 17:00 Bancroft 1.15a (Demonstrator Session)

                • Deadlines


                  Reading homework becomes available each Monday morning.

                  A quiz testing your comprehension of the reading homework will be carried out (from week 3)  every Thursday 

                  Section B Project work must be pushed to GitLab and tagged by: 12 noon, 29/01/2018

                  Section C Project work must be pushed to GitLab and tagged by: 12 noon, 19/02/2017

                  Section D Project work must be pushed to GitLab and tagged by: 12 noon, 03/04/2017

                  Late submission rules for Section C and D:

                  You receive a penalty of 20% per 24 hour period that the homework is late. So if the homework is due at noon on Monday and the work is submitted on Tuesday before noon - then a 20% penalty applies. Note - this means 20% is subtracted from your final mark - so after 5 days you receive 0 marks.

                  In the absence of any written instructions (by email or otherwise) that the project will be handed in late, then if you have not made any "tag" of your work then whatever is committed to your git repository as of the deadline will be marked with a small penalty for failing to tag as detailed in the relevant worksheet instructions. If you have let me know that the work will be submitted late then whatever is tagged will be marked with the appropriate penalty for late submission.

                  If you have extenuating circumstances then it is important that you let me know as soon as possible.

                  Also note that you will not normally be penalised for technical issues with our systems that our out of your control.

                  • Marking Scheme

                    The module is assessed through 3 different forms of in-class assessment:

                    1. Submitted coursework/homework:

                       Three projects constituting a total of 60% of the module marks

                     Section B : 5%

                     Section C : 25%

                     Section D : 30%

                    2. Weekly quizes:

                        Weekly reading homework will be set and assessed through a quiz each Monday or Thursday. This contributes to 20% of the module marks

                    3. Achievements:

                        Each week students are given the opportunity to demonstrate achievements in 9 different categories. This contributes to 20% of the module marks

                    • Weekly Quizzes

                      Weekly quizzes contribute to 20% of the module mark.  They are held on the previous lecture and the reading homework. The final mark will be composed  from  the N_1 best marks from all N assessed quizzes. The first assessed quiz  will take place in week 3 on Thursday, Jan 25th, 2018. In week 2,  on Thursday 18th, we will have a  non-assessed  quiz  about the content of Lecture1 and the reading material 'C++Introduction'.

                    • Code Examples and Templates

                      Here you can find the code templates for Section C - these are also available on gitlab: