Lecture1

For large complex programs steps 4 and 5 are by far

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ep 4: Debugging, debugging, debugging ... Step 5: User support and maintenance The more time one spends on Steps 1 and 2, the easier are the remaining steps. For large complex programs, Steps 4 and 5 are, by far, the most time consuming. In some cases, algorithm development in Step 2 is extremely challenging. Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 20 The C Programming Language ❖ Developed by Dennis Ritchie in the early 1970s. ❖ Originally intended to implement the Unix operating system. ❖ C is an extremely flexible language: it is possible to write high-level complex programs in C on one hand, while being able to deal with details on the level of bits on the other hand. ❖ Serves as the backbone for C++ and Java. ❖ Millions of important engineering programs are written in C. Th i s i s t h e l a n g u ag e we’l l s t u d y i n ECE15! Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 21 Outline of this Lecture ❖ Computer hardware -- overview ❖ Computer software -- overview ❖ Our Ver y First C Programs ❖ Some relevant history Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 22 How to Say “hello world” in C? /* The traditional first program in honor of Dennis m Ritchie who invented C at Bell Labs in 1972 */ #include <stdio.h> int main() { printf("hello world!\n"); return 0; } RUN Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 23 Simple Addition Program in C Task: Read 10 arbitrary numbers from the user and print their sum. Step 1: Analysis of the task -- definition of the input and of the desired output. ‣ Input: a sequence of 10 integers ‣ Output: their sum Step 2: Design of the program: ‣ Developing an algorithm ‣ Designing the appropriate data structure ‣ The algorithm will already be very simple! Lecture Unit 1 ECE15: Introduction to Computer Programming Using the C Language 24 Simple Addition Program: Design ❖ The Algorithm: ‣ Initialize the sum to zero. ‣ Do 10 times the following: ‣ Output (print) the sum. ๏ Read the next integer value from the input ๏ Add this value to the current running sum ❖ Data Structure: We will need three varia...
View Full Document

Ask a homework question - tutors are online