120 likes | 129 Views
A course designed to introduce students to the fundamentals of structured programming using the C++ language. Topics covered include variables, functions, control structures, arrays, pointers, and introduction to object-oriented programming.
E N D
Imam Mohammad bin Saud Islamic University College of Computer Science and Information Computer Science Department CS 140 Computer Programming (I) First semester- 2013-2014 (3 credits) • L. Dania Alomar
Instructor • Lecturer Dania Alomar, • College of Computer science and Information, • My Email: cs.dania@yahoo.com • Office: 3165. • Office hours: • Sun: 2nd lecture. • Tue: 2nd lecture. • Wed: 3rd , 4th lectures. • Thurs: 2nd lecture.
Textbook • Textbook : • C++ How to Program, • by Deitel and Deitel, Pearson • 7th or 8th Edition. • References : • C++ Programming: From Problem Analysis to Program Design, • by De D. S. Malik, • 2006
Objectives • Introduce fundamentals of structured programming, with emphasis on understanding functions, variables, and control structures. • Introduce various tools used in programming, including editors, compilers, linkers, and loaders. • Use the C++ language to implement the problem solving and algorithm design skills. • Declare and use C++ class objects, their methods and attributes • Understand the concept of a pointer variable and a dynamic data variable and be able to declare and use them in C++ programs. • Learn how to write and use recursive functions • Declare and manipulate different kinds of arrays
Topics Covered This course will cover the following topics: • General introduction to C++ programming • Complete C++ program • Variables • Functions • Control Structures • Arrays • Pointers • Introduction to OO programming
Grading • 1stmidterm (15%) will be on the 8thweek of the semester. 22 oct,2013 ,Tuesday 6th lecture. • 2ndmidterm (20%) will be on the 14th week of the semester. 3 Dec,2013, Tuesday 6th lecture. • Quizzes(10%). • Lab(15%). • Final exam (40%).
Policies • Handouts will be uploaded to the course web site. • Any announcement will be posted on the course web site. It is your responsibility to check course website once in a while to keep yourself updated. • It is necessary to attend the class and lab regularly to build a comprehensive foundation of the course. If you exceed the limit of absence (total of 15 hours) you will not be allowed to enter the final exam. Second time late class coming; student will be considered absent for 1 day. • Absence from lab sessions is considered as part of your overall absence. • No makeup quizzes for any reason. If you do not show up you will get a zero. • No makeup midterm and final exams. If you have an approved circumstance, you will be allowed to enter a comprehensive exam at the end of this semester. The exam will include the whole curriculum. • You should present your medical excuses, signed by the committee of excuses, no later than a week from your absence. Otherwise, it will not be accepted. • Studying is from the book; correct answers are drawn from the text book. • TAs are responsible for lab marks. Lecturers will not change the mark given by a TA.
Problem Solving • Programming is a process of problem solving • Problem solving techniques • Analyze the problem • Outline the problem requirements • Design steps (algorithm) to solve the problem • Algorithm: • Step-by-step problem-solving process • Solution achieved in finite amount of time
Representation of Algorithms • A single algorithm can be represented in many ways: • Formulas: F = (9/5)C + 32 • Words: Multiply the Celsius by 9/5 and add 32. • Flow Charts. • Pseudo-code. • In each case, the algorithm stays the same; the implementation differs!
Sequential - The next sequential instruction is executed(Default flow of execution) • Conditional - An instruction is conditionally executed based upon a conditional expression being true. • Iteration - A sequence of instructions are repeatedly executed for a specified number of iterations.
Exercises • Write an algorithm that asks the user to enter an integer number and prints the square of that number. • Write the algorithm that calculates the area of a circle that the user wants. (Area of a circle = 3.14 X radius X radius). • Write the algorithm that asks the user to enter two integer numbers and to choose to make either addition or subtraction of those two numbers. Finally, you have to print the result of the chosen operation.
Cont. • Suppose that the cost of sending an international fax is calculated as follows: Service charges SR 3.00; SR 0.20 per page for the first 10 pages; and SR 0.10 for each additional page. Design an algorithm that asks the user to enter the number of pages to be faxed. The algorithm then uses the number of pages to be faxed to calculate the amount due.