PHY225

From Programming In C

Introduction to programming, what is a computer program, compilation etc
basic C program, syntax rules, variables, naming variables, the printf statement

Exercise: Hello, World!
Exercise: Large letter



Data types, assignment statements, operators, operator precedence

Exercise: Real roots of a quadratic equation
Exercise: Volume converter



Use of the if, while, switch and for statements

Exercise: Hello, world! revisited
Exercise: Factorial
Exercise: Quadratic roots revisited



Techniques for planning and writing an algorithm as a C program, 
use of flow diagrams, step-by-step solutions to two past assessments

Exercise: Day of week
Exercise: Newton-Raphson method



Function definitions, passing arguments to functions, 
returning values from functions, math.h library

Exercise: Replacement pow() function
Exercise: Simple sort function



Input file handling, output file handling, multiple streams, 
use of printf to format output, more on scanf

Exercise: Cartesian to polar conversion (Vectors Data File)
Exercise: Student database (Students Database File)



1 dimensional arrays, multidimensional arrays, arrays as function variables, 
dynamic array allocation

Exercise: Matrix multiplication
Exercise: Pascal's triangle



Character strings and string operators.
Definition of structures and their use, arrays of structures, 
passing a structure to a function, arrays inside structures.

Exercise: Full name
Exercise: Planets in the Solar System (Planets Data File)



A simple algorithm for sorting


phy225: Course Details

general


compilers


2012-13 assessments


past exam papers

  • 2008-9 (http://physics-database.group.shef.ac.uk/exampapers/2008-09/PHY225%20LT.pdf)
  • 2009-10 (http://physics-database.group.shef.ac.uk/exampapers/2009-10/PHY225%20Exam%20Sem%201%202009-10.pdf)
  • 2010-11 (http://physics-database.group.shef.ac.uk/exampapers/2010-11/PHY225_10_11.pdf)