Instructor: Chien-Ho Ko

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 1 Engineering Problem Solving.
Advertisements

EC-111 Algorithms & Computing Lecture #1 Instructor: Jahan Zeb Department of Computer Engineering (DCE) College of E&ME NUST.
Introduction to Programming Lecture 2. Today’s Lecture Software Categories Software Categories System Software System Software Application Software Application.
COSC 120 Computer Programming
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
Introduction to C Programming
C programming Language and Data Structure For DIT Students.
Chapter 1 Introduction to Programming. Computer Hardware CPU Memory –Main or primary –Secondary or auxiliary Input device(s) Output device(s)
CHAPTER 1: INTORDUCTION TO C LANGUAGE
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Programming In C++ Spring Semester 2013 Programming In C++, Lecture 1.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice:
Programming With C.
Introduction to C++ Programming Language
Evolution and History of Programming Languages. Machine languages Assembly languages Higher-level languages To build programs, people use languages that.
Evolution and History of Programming Languages. Software Programming Language.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Hardware and Software Programming. COMP104 Lecture 2 / Slide 2 Hardware and Software l Why should we bother with hardware, while we are having a programming.
CS Computer Science I. BCPL was developed in 1967 as a language for writing operating systems and software compilers In 1970, the creators of the.
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
 Getting ready to code Lecture 1 Match 4, Course syllabus 
CHAPTER 1.1 INTRODUCTION TO COMPUTERS AND C++ Dr. Shady Yehia Elmashad.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 1 – Introduction to C.
Introduction to C Programming Language. History of C  C was evolved by Dennis Ritchie at AT&T Bell Laboratories in early of 1970s  Successor of: ALGOL.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
C Programming Lecture 3 : C Introduction 1 Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Computer Software.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
By Kundang K Juman Hardware & Software. COMP102 Prog. Fundamentals I: Software / Slide 2 l Four components of a computer system: n CPU - central processing.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
History of C and basics of Programming
Chapter 1 Introduction 2nd Semester H
Foundations of Computer Science C & C++ programming lecture 2
BASIC PROGRAMMING C SCP1103 (02)
UMBC CMSC 104 – Section 01, Fall 2016
Chapter 1: Introduction to computers and C++ Programming
CSCI-235 Micro-Computer Applications
BASIC PROGRAMMING C SCP1103 (02)
Introduction to C Language
Computer Programming (CS-161)
Microprocessor and Assembly Language
Intro to Programming Week # 1 Hardware / Software Lecture # 2
CHAPTER 1: Introduction to Computers and Programming
TRANSLATORS AND IDEs Key Revision Points.
Computer Science I CSC 135.
Introduction to C Programming
Hardware & Software Programming. COMP102 Prog. Fundamentals I: Software / Slide 2 l Four components of a computer system: n CPU - central processing unit.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
National Diploma in Computer Studies
Programming Fundamentals Lecture #3 Overview of Computer Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
C programming Language
Introduction to Computer Programming
PROGRAM AT RUNTIME Subject code: CSCI-620
System Programming By Prof.Naveed Zishan.
Presentation transcript:

Instructor: Chien-Ho Ko Introduction to C Instructor: Chien-Ho Ko

Outlines Introduction to Computers Programming Language C Programming Environment How to Run C Programs First Program

Introduction to Computers Computer VS Computer Systems Computer Hardware Categories of Software

Computer VS Computer Systems

Computer VS Computer Systems Hardware (the computer) Data (information) Software (program) People (User)

Computer Hardware

Computer Hardware Memory Storage Processor Output Input Output

Categories of Software System software: tells computers how to use its own components: Windows, Unix, Linux, Macintosh… (interpreter between Hardware & application) Application software: tells computers how to accomplish specific tasks

Programming Language What is Programming Language Machine Languages Assembly Languages High Level Languages

What is Programming Language A set of instructions that perform a specific task What is Programming Language An artificial & formal language making up instructions and a set of precise grammar rules

Machine Languages The natural language of a computer Drawbacks Instructions are extremely difficult Simple problems require large number instructions Machine-dependent Un-portable 0101 1000 0001 0101 1011 0001 0101 0000 0001

Assembly Languages Instructions consists of English-like abbreviations to make computers easier to program. Drawbacks Simple problems require large number instructions Machine-dependent Un-portable L 1, GROSSPAY S 1, TAX ST 1, NETPAY

High Level Languages Instructions are quite English-like Single instruction: operations Drawback Must be converted to machine languages High level Assembly Machine NETPAY = GROSSPAY - TAX;

C Programming Environment Why C How Does C Work How Does NXC Work IDE Language & Libraries

Why C-Never Out of Date 1970’s Dennis Ritchie, Bell Lab. High level (convenient) + assembly (powerful) Approved by American National Standard Institute Portable C++=C + OO + New Feature

Why C-Never Out of Date NXC adopts C grammar The most popular language for NXT

How Does C Work After loader transfers load module to main memory, CPU executes Process Text (source program)  Preprocessor (special instructions)  Translator (compiler)  Object Program (machine language)  Linker (library)  Load module (Executable machine language)

How Does NXC Work After firmware loads bytecode to memory, CPU executes Process Text (NXT code, source program)  Preprocessor (special instructions)  Translator (compiler)  Linker (library)  Object Program (Next bytecode in PC)  Object Program (Next bytecode in NXT)

Integrated Develop Environment Text editor+ Preprocessor +C Compiler+ Library + Debug Microsoft VC++ Borland Turbo C++ Text editor+ Preprocessor +NXC Compiler+ Library + Debug BricxCC

Language & Libraries Language Libraries Provides basic operations Extend C Standard libraries: # include <stdio.h> Programmer-defined libraries: # include <chko.h>

How to Run C Programs Edit: Create text, 03_c01.c Preprocess: Special instructions Compile: machine language Link: libraries Run: executable machine language

First Program 1 /************************************************************* 2 Program Filename: 03_c01.c 3 Author: Chien-Ho Ko 4 Purpose: Draw triangle and trapezoid. 5 Output to: Screen 6 *************************************************************/ 7 #include <stdio.h> 8 9 int main(void) { 10 11 /* Function body: */ 12 13 printf("+----------------+\n"); 14 printf("| |\n"); 15 printf("| |\n"); 16 printf("| |\n"); 17 printf("+----------------+\n"); 18 19 printf(" /\\\n"); 20 printf(" / \\\n"); 21 printf(" / \\\n"); 22 printf(" / \\\n"); 23 printf("+------------+\n"); 24 25 return 0; 26 } /* end function main */

First Program NXC 1 /************************************************************* 2 Program Filename: 03_NXC01.nxc 3 Author: Chien-Ho Ko 4 Purpose: Basic robot control. 5 Output to: Motors 6 *************************************************************/ 7 8 task main() 9 { 10 OnFwd(OUT_A, 75); 11 OnFwd(OUT_C, 75); 12 Wait(100); 13 Off(OUT_AC); 14 } /* end function main */