小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Lecture 2 Introduction to C Programming
Introduction to C Programming
 2005 Pearson Education, Inc. All rights reserved Introduction.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
CSE1301 Computer Programming Lecture 4: C Primitives I.
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?
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
 2003 Prentice Hall, Inc. All rights reserved. 1 Machine Languages, Assembly Languages, and High-level Languages Three types of computer languages 1.Machine.
C programming Language and Data Structure For DIT Students.
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
“C” Programming Language CIS 218. Description C is a procedural languages designed to provide lowlevel access to computer system resources, provide language.
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Object-Oriented Programming in C++
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
Spring 2005, Gülcihan Özdemir Dağ BIL104E: Introduction to Scientific and Engineering Computing, Spring Outline 1.1Introduction 1.2What Is a Computer?
CSE 2541 – Advanced C Programming Instructor: Yang Zhang
EKT 120/4 C Programming (Additional note). Computer Fundamentals Computer is a machine that can receive, store, transform an output data of all kinds.
Programming With C.
History of C 1950 – FORTRAN (Formula Translator) 1959 – COBOL (Common Business Oriented Language) 1971 – Pascal Between Ada.
CSE 2541 – Advanced C Programming. Course info Prereq – CSE 2221 or CSE 222 Co-req – CSE 2231 Website
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Introduction to C Programming Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010 Fall.
C Language: Introduction
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
Agenda Computer Languages How to Write a Simple C Program
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Chapter 1 Introduction to Computers, the Internet and the Web.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
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 is a high level language (HLL)
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
INTRODUCTION TO PROGRAMING System Development Mansoura October 2015.
Software Engineering Algorithms, Compilers, & Lifecycle.
C++ Programming Chapter 1 Programming & Programs.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
From Algorithms to Programs Both are sets of instructions on how to do a task Algorithm: –talking to humans, easy to understand –in plain (English) language.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.
CSCE 206 Structured Programming in C
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
Introduction to C Language
Chapter 2 - Introduction to C Programming
Computer Programming Chapter 1: Introduction
C Programming Hardik H. Maheta.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Getting Started with C.
Chapter 2 - Introduction to C Programming
Introduction to C Programming
Visit for more Learning Resources
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Govt. Polytechnic,Dhangar
Introduction to C Topics Compilation Using the gcc Compiler
Chapter 2 - Introduction to C Programming
Introduction to C Topics Compilation Using the gcc Compiler
Programs written in C and C++ can run on many different computers
Chapter 2 - Introduction to C Programming
The C Language: Intro.
Course Outcomes of Programming In C (PIC) (17212, C203):
Introduction to C Programming
Presentation transcript:

小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟 歌詞知多少 - 挑戰你的腦容量

Winter Projects

陳怡芬 Anny Problem Solving & Programming

Pair Programming

Driver and Navigator working together on one task Roles changing often Collective responsibility for outcome Bringing together of multiple perspectives, experiences, abilities, and expertise

Why pair? Higher quality code Faster cycle time Enhanced trust/teamwork Knowledge transfer Enhanced learning More fun

When do we need to programming? Why should you learn how to programming? For Problem Solving & Became a Power User

How many programming lanugages

Programming languages Machine code Bits, octal, or at most decimal numbers Assembler Registers, load, store, integer add, floating point add, … Each new machine had its own assembler Higher level languages First: Fortran and COBOL Rate of language invention At least 2000 a decade Major languages today Really solid statistics are hard to come by IDS: about 9 million professional programmers COBOL, Fortran, C, C++, Visual Basic, PERL, Java, Javascript Ada, C#, PHP, …

History of Programming Languages

Early programming languages Classic C Simula Pascal Algol68 BCPL Fortran Lisp COBOL Algol60 PL\1 1950s:1960s:1970s: Red==major commercial use Yellow==will produce important “offspring”

Modern programming languages Object Pascal C++ Java95 C#Ada98 C++98 Java04 C++0x Python Lisp Smalltalk Fortran77 Ada Eiffel Simula67 COBOL89 PHP C89 Pascal PERL Visual Basic COBOL04 Javascript

1950s: Fortran Fortran has the equivalent of Unix file descriptors: UNIT=5 for stdin, UNIT=6 for stdout and UNIT=0 for stderr. ! FORTRAN 77 example PROGRAM MAIN READ(UNIT=5,*)NUMBER WRITE(UNIT=6,'(F5.3)')' NUMBER IS: ',NUMBER END

1968: ALGOL 68 # ALGOL 68 example # main:( REAL number; getf(stand in,($g$,number)); printf(($"Number is: "g(6,4)"OR "$,number)); # OR # putf(stand out,($" Number is: "g(6,4)"!"$,number)); newline(stand out) )

1970s: C and Unix 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */

1995: Java

2000s:.NET

熱情能驅動他們把軟體的某一個面向雕琢到極致,這需要 超乎常人的毅力和堅持,以及絕不向壓力妥協的精神 …

The world’s first computer programmer. You read that right, a woman was the first programmer! Born in 1815, Lovelace wrote programs for an early analytical engine built by Charles Babbage. Ada Lovelace (1815–1852) Women will take over the world!

Ada (programming language) Ada was originally targeted at embedded and real-time systems.embeddedreal-time with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line("Hello, world!"); end Hello;

The C Language Currently, the most commonly-used language for embedded systems High-level assembly Very portable compilers exist for virtually every processor Easy-to-understand compilation Produces efficient code Fairly concise

C History Developed between 1969 and 1973 along with Unix Due mostly to Dennis Ritchie Designed for systems programming Operating systems Utility programs Compilers Filters

Computer Architecture ALU Control CPU Input Output Memory Input Device Output Device

Main Parts of C Programs

Our First C Program  Hello World

/* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); }

The #include Directive /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } include information about standard library C preprocessors C preprocessors start with #

C Standard Library C preprocessors C preprocessors start with #

Entry Point of C Programs /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } define a function called main that receives no argument define a function called main that receives no argument Function body

Function Body /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } Function body Function body starts with { Function body ends with }

C Statements /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } a C statement C statements end with ;

Comments /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /*... */ or // for multiple lines (c++) for single line

Comments /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /* Hello.c Our first program */ #include /* function main begins program execution */ main() { printf("hello, world\n"); } /*... */ or // for multiple lines (c++) for single line // Hello.c // Our first program #include // function main begins program execution main() { printf("hello, world\n"); } // Hello.c // Our first program #include // function main begins program execution main() { printf("hello, world\n"); }

Robot’s Movement

標準輸出入裝置與輸出入函式

標準輸出入裝置 ALU Control CPU Input Output Memory Input Device Output Device Input Output 預設

標準輸出入函式

printf  Print formatted data to stdout

scanf  Read formatted data from stdin

Add Two Integers 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ integer1 integer2 sum = integer1 + integer2

Add Two Integers 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 1/* AddTwoInts.c 2 Addition program */ 3#include <stdio.h> 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ integer1 integer2 sum Enter first integer Enter second integer Sum is 35 >

1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 標準輸出入裝置之重新導向 標準輸出裝置重新導向 : > Outfile 標準輸入裝置重新導向 : < Infile 標準輸出裝置重新導向 : > Outfile 標準輸入裝置重新導向 : < Infile integer1 integer2 sum

1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 標準輸出入裝置之重新導向 標準輸出裝置重新導向 : > Outfile 標準輸入裝置重新導向 : < Infile 標準輸出裝置重新導向 : > Outfile 標準輸入裝置重新導向 : < Infile integer1 integer2 sum

1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 1/* AddTwoInts.c 2 Addition program */ 3#include 4 5/* function main begins program execution */ 6main() 7{ 8 int integer1; /* first number to be input by user */ 9 int integer2; /* second number to be input by user */ 10 int sum; /* variable in which sum will be stored */ printf( "Enter first integer\n" ); /* prompt */ 13 scanf( "%d", &integer1 ); /* read an integer */ printf( "Enter second integer\n" ); /* prompt */ 16 scanf( "%d", &integer2 ); /* read an integer */ sum = integer1 + integer2; /* assign total to sum */ printf( "Sum is %d\n", sum ); /* print sum */ 21} /* end function main */ 標準輸出入裝置之重新導向 標準輸出裝置重新導向 : > Outfile 標準輸入裝置重新導向 : < Infile 標準輸出裝置重新導向 : > Outfile 標準輸入裝置重新導向 : < Infile integer1 integer2 sum

// Hello.c // Our first program #include // function main begins program execution main() { printf("hello, world\n"); } // Hello.c // Our first program #include <stdio.h> // function main begins program execution main() { printf("hello, world\n"); } printf  Print formatted data to stdout function name function Parameter (string)

#include #include int main( ) { int num; printf("Input a number:"); scanf("%d",&num); if (num>=0) printf(" 正數 "); else printf(" 負數 "); system("PAUSE"); return 0; }

// 程式功能:求解 BMI // 作者: Anny // 完成日期: 2005/4/1 #include #include int main( ) { float height, weight, BMI; printf("height=?(m)"); scanf("%f",&height); printf("weight=?(Kg)"); scanf("%f",&weight); BMI = weight / (height * height); printf("BMI = %f \n", BMI); if (BMI =18) &&(BMI <20)) printf(" 穠纖合度!! \n"); else printf(" 太重了喔!應注意。 \n"); system("PAUSE"); return 0; }

printf  Print formatted data to stdout printf("Hello, World\n"); Instructs computer to perform an action Specifically, prints the string of characters within quotes ( " " ) Entire line called a statement All statements must end with a semicolon ( ; ) Escape character ( \ ) Indicates that printf should do something out of the ordinary \n is the newline character

Some Common Escape Sequences

Editing  Compiling  Linking  Execution system("pause"); #include