• Programming Languages • History of C • Problem Solving – Flowcharts – Algorithms – Programs

Only available on StudyMode
  • Download(s) : 157
  • Published : December 19, 2010
Open Document
Text Preview
ISE105: Computer Fundamentals
Lecture 7

Samin Khaliq

Today’s Lecture
• Programming Languages • History of C • Problem Solving – Flowcharts – Algorithms – Programs

• C Program • Comments

Types of Programming Languages
Low Level Languages
1. Machine language (1GL)
• • Strings of numbers giving machine specific instructions Example: Calculates nth Fibonacci number 8B542408 FA027706 B9010000 C84AEBF1 83FA0077 06B80000 0000C383 B8010000 00C353BB 01000000 008D0419 83FA0376 078BD98B 5BC3

2. Assembly language (2GL)
• • English-like abbreviations representing elementary computer operations (translated via assemblers) Example: fib: mov edx, [esp+8] cmp edx, 0 ja @f mov eax, 0 ret …


Types of Languages
3. High-level languages (3GL)
• Codes similar to everyday English • Use mathematical notations (translated via compilers) • Example: grossPay = basePay + overTimePay

• Languages:
– C, C++, Java, FORTRAN, COBOL, Pascal


Development of programming languages

Development of Programming Languages
• 2000  C# . . • 2001  Visual Basic .NET . . . . • 2009  Go by Google Inc. (Similar to C)

A brief history of C
• Developed Dennis M. Ritchie at AT&T Bell Labs between 1969–1973 for UNIX • Descendant of Ken Thompson’s language “B” • First published specification standard: – Ritchie and Brian Kernighan “The C Programming Language” in 1978 – C-dialect now known as K&R-Style

• Ease of portability ⇒ language began to spread • However language standard (K&R) insufficiently precise • A slightly modified version of K&R was standardised by ANSI 1989 – C-dialect now known as ANSI-C

• The latest revision of the Standard is C99 (ISO) • ISO/IEC JTC1/SC22/WG14 is the international standardization working group for the programming language C.

Dennis Ritchie and Ken Thompson

C and C++
• C++ is descended from C
– Written by Bjarne Stroustrup during 1983-1985 – Originally called “C with Classes”

• ISO/IEC JTC1/SC22/WG21 has produced the standard ISO/IEC 14882:1998 on the programming language C++. • A technical corrigendum was approved in 2003. • C and C++ are different languages

Why C / C++ ?
• High level language
– C is higher level than assembler but still close to the hardware and allows direct manipulation of many system aspects: pointers, memory allocation, bitwise manipulation.

• Widely used across the world
– Portability - Programs can run on many different computers

• Fast • Structured (Extensive use of functions)

C and C++ popularity (www.tiobe.com)

Problem Solving and Implementation
• A typical programming task can be divided into two phases: • Problem solving phase – Produce an ordered sequence of steps that describe solution of problem – This sequence of steps is called an algorithm

• Implementation phase
– Implement the program in some programming language

Developing a program
Problem solving phase

Implementation phase

• Algorithm
– A sequence of language independent steps which may be followed to solve a problem.

• Flowchart
– Diagrammatic representation of steps for solving the given problem.

• Program
– A precise sequence of steps to solve a particular problem

• Programming languages
– Languages for specifying sequences of directions to a computer.

• Read in the temperature. If the temperature is less than 32 indicate it as below freezing on the screen. Else if the temperature is above freezing then indicate the same on the monitor screen. • Divide the above problem into manageable parts. – Input – Processing – Output

Input: Temp if (Temp < 32) then Print “BELOW FREEZING” else Print “ABOVE FREEZING” endif

Flowchart Symbols

Integrated Development Environment (IDE)
• Software Application for software development • • • • A source code editor A compiler and / or an interpreter Build automation tools A Debugger

Basics of a Typical C Program Development Environment Phases of C...
tracking img