CGS 3460 PROGRAMMING USING C Spring 2007 Instructor: Rong Zhang TAs: Ting Chen and Sungwook Moon.

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240.
COSC 120 Computer Programming
Chapter Chapter Goals Describe the layers of a computer system Describe the concept of abstraction and its relationship to computing Describe.
Chapter 9_3 Following Instructions: Principles of Computer Operation.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Java Environment (CSS444)
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 1 – Introduction to Computers and C++ Programming.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers and C++ Programming Outline 1.1Introduction 1.2What Is a Computer?
1 The development of modern computer systems Early electronic computers Mainframes Time sharing Microcomputers Networked computing.
C programming Language and Data Structure For DIT Students.
CSE : Programming in C Instructor: Lei Wang Office: Dreese Lab 474 Office Hour: Friday.
CHAPTER 1: INTORDUCTION TO C LANGUAGE
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
Computer Software.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Chapter 01 Nell Dale & John Lewis.
Chapter Introduction to Computers and Programming 1.
Chapter 17 Programming Tools The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander.
Introduction COMP104: Fundamentals and Methodology.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
CS 1 •This is Computer Science 1. •Who is Professor Adams?
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CS 1410 Intro to Computer Tecnology Computers and History1.
Introduction to Computers and Programming – Computer Programming.
CSE 2541 – Advanced C Programming Instructor: Yang Zhang
Chapter 1 The Big Picture.
Course Overview. What are Computers? From Outside –CPU box, Monitor, Keyboard, mouse and Printers From inside –ICs, Chipsets, Hard Disks, PCB cards, Drives,
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Programming With C.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Introduction to Computers Outline 1.1Introduction.
 2006 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Systems Software Operating Systems. What is software? Software is the term that we use for all the programs and data that we use with a computer system.
CSE 2541 – Advanced C Programming. Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
1 Lecture 2 : Computer System and Programming. Computer? a programmable machine that  Receives input  Stores and manipulates data  Provides output.
Liang, Introduction to C++ Programming, (c) Chapter 1 Introduction to Computers, Programs, and C++
C Language: Introduction
CGS 3460 Why we choose UNIX n Powerful lMulti-user operating system lGood programming tools Most heavy-duty database management systems started out on.
1 Operating Systems: Principles and Practice Cpr E 308.
CGS 3460 CGS 3460 PROGRAMMING USING C Summer 2007 Instructor: Neko Fisher TAs: Ritwik Kumar.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Agenda Computer Languages How to Write a Simple C Program
CS 251 C Programming for Engineers Spring 2016 Instructor: Dick Lang.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Chapter 4 Software. Introduction Program: is a set of sequence instructions that tell the computer what to do. Software: is a collection of programs,
CHAPTER 1.1 INTRODUCTION TO COMPUTERS AND C++ Dr. Shady Yehia Elmashad.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
INC 161 , CPE 100 Computer Programming
BASIC PROGRAMMING C SCP1103 (02)
Computer Science 2 What’s this course all about?
Chapter 1 The Big Picture
CSCI-235 Micro-Computer Applications
BASIC PROGRAMMING C SCP1103 (02)
Computer System and Programming
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Programming COMP104: Fundamentals and Methodology Introduction.
CS190/295 Programming in Python for Life Sciences: Lecture 1
Computer Science I CSC 135.
Fundamentals of Computer Programming
Chapter 1 Introduction(1.1)
Text by: Lambert and Osborne
Introduction to Computer Programming
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
Presentation transcript:

CGS 3460 PROGRAMMING USING C Spring 2007 Instructor: Rong Zhang TAs: Ting Chen and Sungwook Moon

Goals We will learn –Read: Understand programs written in C language –Write: Design and implement programs using C language –Compile: Use compiler to convert C code into executable file under UNIX –Execute: Run corresponding code to get results –Debug: Identify and fix syntax and semantic errors in C code. Appropriate for –Technically oriented people with little or no programming experience –Experienced programmers who want a deep and rigorous treatment of the language

New View of Computers From a programmer’s viewpoint –Computers are tools –A computer program turns raw data into meaningful information –A program is the driving force behind any job that any computer does A program is a list of detailed instructions These instructions are written in certain programming language

Available Programming Languages Machine Languages Assembly Languages High-level Languages –C/C++ –COBOL –Pascal –BASIC –Fortran –JAVA –Etc.

Machine Languages System of instructions and data directly understandable by a computer's central processing unit. Example: Every CPU model has its own machine code, or instruction set, although there is considerable overlap between some

Assembly Languages Human-readable notation for the machine language that a specific computer architecture uses representing elementary computer operations (translated via assemblers) Example: load hourlyRate mul workHours store salary Even into the 1990s, the majority of console video games were written in assembly language.

High-level Languages Higher level of abstraction from machine language –Codes similar to everyday English Use mathematical notations (translated via compilers) –Example: salary = hourlyRate * workHours Make complex programming simpler

Why Programming using C Initial development occurred at Bell Labs in early 70’s by Ritchie General-purpose computer programming language –high-level assembly –Simplicity and efficiency of the code The most widely used programming languages –Commonly used for writing system software –Widely used for writing applications –Hardware independent (portable) Great influence on many other popular languages

Textbooks Required Programming in C (3rd Edition) by Stephen Kochan. ISBN: Link for the book from amazon: Recommended Reading Absolute Beginner's Guide to C by Greg Perry. ISBN: Link

Outline of the Course – I Introductions –Familiarization with programming environment, telnet / SSH Secure Shell, ftp / SSH Secure File Transfer, UNIX, Compiling / gcc C program structure Basic data types and variables declaration Arithmetic expressions and operators Control statements. –Conditional statements –The while loop –The do while loop –The for loop –The if else statement –The switch statement –The break statement –The continue statement

Outline of the Course – II Formatted Input and Output Arrays and Strings Functions –Declarations –Calling Pointers Struct, Union, Enums Preprocessor * Advanced Material –Debug using gdb –Arrays and Pointer Arithmetic –Binary Trees –Link Lists –Recursive Functions * may be adjusted according to time and interests of students

Grading Scale You earn your grade Final grade is calculated according to the following schedule Home works30% Quizzes20% Mid-term exam20% Final exam / Project 30% Grade scale is: A(100-90),B+(89-85),B(84-80),C+(79-75), C(74-70),D+(69-65),D(64-60),F(59-0)

Policies Attendance and Expectations Homework Policies Make-up Exam Policy Other Policies –Re-grading Course is on WebCT

History - I Konrad Zuse's Z1 Circa 1936 The first freely programmable binary computer Konrad Zuse's in Germany Innovations –Floating-point arithmetic –High-capacity memory –Modules or relays operating on the yes/no principle. From

History - II The first electronic- digital computer Iowa State University Innovations –A binary system of arithmetic –Parallel processing –Regenerative memory –Separation of memory and computing functions Atanasoff-Berry Computer From

History- III ENIAC I (Electrical Numerical Integrator And Calculator) John Mauchly and J Presper Eckert 500,000 dollars Thousand times faster –17,468 vacuum tubes –70,000 resistors –10,000 capacitors, etc –800 square feet floor space –30 tons –160 kilowatts of electrical power The ENIAC 1946 From

History- IV First home computer –Scelbi –Mark-8 Altair –IBM 5100 Computers 1974/1975 Altair –8080 CPU –256 Byte RAM card –$400 –The consumer needs to put them together, make it work and write any needed software. –Paul Allen and Bill Gates develop BASIC for the Altair 8800 From Mark-8 Altair

History- V Personal computer –IBM PC in 1981 –Apple Macintosh in 1984 –Microsoft Windows 1.0 ships in November, 1985 –Network original IBM PC 1981

Operating System What is OS? –A program that allows you to interact with the computer -- all of the software and hardware With a command-line operating system (e.g., DOS) With a graphical user interface (GUI) operating system (e.g., Windows) Two major classes of operating systems –Windows Nice interface, easy to learn –Unix reliable timesharing operating system

Why we choose UNIX Powerful –Multi-user operating system –Good programming tools Most heavy-duty database management systems started out on Unix Flexible –Thousands of tools that can be combined and recombined. Reliable –Unix is hard to crash.

How to Access a UNIX Machine Your personal computer (client) grove.ufl.edu (server) telnet / ftp telnet: allows you to connect to other computers and use softwares there ftp: allows you to retrieve files from other computers.

Telnet TELetype NETwork –A network protocol used on the Internet / LAN –By extension, refers to the program which provides the client part of the protocol Once connected –Log on as a regular user with access to application / software data A Telnet command request looks like this –telnet grove.ufl.edu

FTP File Transfer Protocol –A network protocol used on the Internet / LAN –Allow to transfer files to and from remote computers A ftp command request looks like this –ftp grove.ufl.edu

SSH Why SSH Figures from Download SSH –

More about SSH Recommendation for Windows –Putty as telnet tool –WinSCP as ftp tool Other choices –ftp, telnet using command line in windows –Other softwares Core FTP

Your First Program #include int main() { printf("Hello World\n"); return 0; } Preprocessor: interact with input/output of your computer You will see this at the beginning of nearly all programs Tells computer to load file named allows standard input/output operations

Your First Program #include int main() { printf("Hello World\n"); return 0; } Start point of the program Preprocessor: interact with input/output of your computer C programs contain one or more functions, exactly one of which must be main int means that the function main will "return" an integer value

Your First Program #include int main() { printf("Hello World\n"); return 0; } Start point of the program Preprocessor: interact with input/output of your computer Start and finish of function

Your First Program #include int main() { printf("Hello World\n"); return 0; } Printing a line of Text Start point of the program Preprocessor: interact with input/output of your computer Start and finish of function

Your First Program #include int main() { printf("Hello World\n"); return 0; } Printing a line of Text Start point of the program Preprocessor: interact with input/output of your computer Start and finish of function New line character

Your First Program #include int main() { printf("Hello World\n"); return 0; } Printing a line of Text Start point of the program Preprocessor: interact with input/output of your computer Start and finish of function Finish and return value 0 A way to exit a function It means that the program terminated normally in this case

Comments for programs Why need comments –Good habit –Readable to others –Remind yourself How to comment –/* … */ –// … Effects on compiler Examples

Compiler What is compiler –A computer program (or set of programs) that translates text written in a computer language ( the source code) into another computer language (most time the executable file) Why we need a compiler Available C compiler in UNIX system: gcc gcc sourcefile.c –o exefile.exe

Text Editor in UNIX Edit your code Using wordpad, MS word on your personal computer –Need to transfer your program to UNIX machine using ftp Edit your code in UNIX using –vi –pico –emacs

Procedure This is your C program. Type the code in any standard text editor, and save it as helloworld.c. Transfer it to grove.ufl.edu if necessary #include int main() { printf("Hello World\n"); return 0; } helloworld.c C-compiler Type gcc helloworld.c –o helloworld.exe to compile helloworld.c into helloworld.exe using the gcc compiler helloworld.exe The gcc compiler generate corresponding executable code named helloworld.exe. The computer can execute this machine readable code if you type./helloworld.exe