Инфоурок Другое ПрезентацииProgramming on Algorithmic Languages

Programming on Algorithmic Languages

Скачать материал
Скачать материал "Programming on Algorithmic Languages"

Получите профессию

Копирайтер

за 6 месяцев

Пройти курс

Рабочие листы
к вашим урокам

Скачать

Методические разработки к Вашему уроку:

Получите новую специальность за 2 месяца

Заведующий доп. образованием

Описание презентации по отдельным слайдам:

  • Programming on Algorithmic LanguagesWeek 1

    1 слайд

    Programming on Algorithmic Languages
    Week 1

  • 1.1 General Notes About C++ and This CourseCourse geared toward novice progra...

    2 слайд

    1.1 General Notes About C++ and This Course
    Course geared toward novice programmers
    Stress programming clarity
    C and C++ are portable languages
    Portability
    C and C++ programs can run on many different computers
    Compatibility
    Many features of current versions of C++ not compatible with older implementations
    2

  • 1.1 General Notes About C++ and This CourseWhat do you need?
Books:
C++ How t...

    3 слайд

    1.1 General Notes About C++ and This Course
    What do you need?
    Books:
    C++ How to Program, Fifth (fourth) Edition By H. M. Deitel -  Deitel & Associates
    C++A Beginner’s Guide By Herbert Schildt
    Absolute C++ By Walter Savitch
    IDE:
    Microsoft Visual C++ 2008 (Express or Professional editions)
    Sites:
    http://cplusplus.com/
    http://e-practice.org
    http://www.iitu.kz/
    Your Mind (Brain)

  • 1.2 Introduction to C++ ProgrammingC++ language
Facilitates structured and di...

    4 слайд

    1.2 Introduction to C++ Programming
    C++ language
    Facilitates structured and disciplined approach to computer program design
    Following several examples
    Illustrate many important features of C++
    Each analyzed one statement at a time
    Structured programming
    Object-oriented programming
    4

  • 1.3 Basics of a Typical C++ EnvironmentC++ systems
Program-development enviro...

    5 слайд

    1.3 Basics of a Typical C++ Environment
    C++ systems
    Program-development environment
    Language
    C++ Standard Library

    5

  • 1.3 Basics of a Typical C++ Environment6Phases of C++ Programs:
Edit
Preproce...

    6 слайд

    1.3 Basics of a Typical C++ Environment
    6
    Phases of C++ Programs:
    Edit
    Preprocess
    Compile
    Link
    Load
    Execute

    Primary
    Memory

    CPU takes each
    instruction and
    executes it, possibly
    storing new data
    values as the program
    executes.

     

    CPU

    .
    .
    .

    .
    .
    .

    Program is created in
    the editor and stored
    on disk.

    Editor

    Disk

    Preprocessor program
    processes the code.

    Preprocessor

    Disk

    Compiler

    Compiler creates
    object code and stores
    it on disk.

    Disk

    Linker links the object
    code with the libraries,
    creates a.out and
    stores it on disk

    Linker

    Disk

    Loader

    Primary
    Memory

    Loader puts program
    in memory.

    .
    .
    .

    .
    .
    .

    Disk

  • 1.3 Basics of a Typical C++ EnvironmentInput/output
cin
Standard input stream...

    7 слайд

    1.3 Basics of a Typical C++ Environment
    Input/output
    cin
    Standard input stream
    Normally keyboard
    cout
    Standard output stream
    Normally computer screen
    cerr
    Standard error stream
    Display error messages
    7

  • 1.3 A Simple Program:Printing a Line of TextComments
Document programs
Impro...

    8 слайд

    1.3 A Simple Program:
    Printing a Line of Text
    Comments
    Document programs
    Improve program readability
    Ignored by compiler
    Single-line comment
    Begin with //
    Preprocessor directives
    Processed by preprocessor before compiling
    Begin with #

    8

  • 91      // Fig. 1.2: fig01_02.cpp
2      // A first program in C++.
3      #i...

    9 слайд

    9
    1 // Fig. 1.2: fig01_02.cpp
    2 // A first program in C++.
    3 #include <iostream>
    4
    5 // function main begins program execution
    6 int main()
    7 {
    8 std::cout << "Welcome to C++!\n";
    9
    10 return 0; // indicate that program ended successfully
    11
    12 } // end function main

    Welcome to C++!
    Single-line comments.
    Preprocessor directive to include input/output stream header file <iostream>.
    Function main appears exactly once in every C++ program..
    Function main returns an integer value.
    Left brace { begins function body.
    Corresponding right brace } ends function body.
    Statements end with a semicolon ;.
    Name cout belongs to namespace std.
    Stream insertion operator.
    Keyword return is one of several means to exit function; value 0 indicates program terminated successfully.

  • 1.31 A Simple Program:Printing a Line of TextStandard output stream object
s...

    10 слайд

    1.31 A Simple Program:
    Printing a Line of Text
    Standard output stream object
    std::cout
    “Connected” to screen
    <<
    Stream insertion operator
    Value to right (right operand) inserted into output stream
    Namespace
    std:: specifies using name that belongs to “namespace” std
    std:: removed through use of using statements
    Escape characters
    \
    Indicates “special” character output
    10

  • 1.31 A Simple Program:Printing a Line of Text


11

    11 слайд

    1.31 A Simple Program:
    Printing a Line of Text




    11

  • 121      // Fig. 1.4: fig01_04.cpp
2      // Printing a line with multiple st...

    12 слайд

    12
    1 // Fig. 1.4: fig01_04.cpp
    2 // Printing a line with multiple statements.
    3 #include <iostream>
    4
    5 // function main begins program execution
    6 int main()
    7 {
    8 std::cout << "Welcome ";
    9 std::cout << "to C++!\n";
    10
    11 return 0; // indicate that program ended successfully
    12
    13 } // end function main

    Welcome to C++!
    Multiple stream insertion statements produce one line of output.

  • 131      // Fig. 1.5: fig01_05.cpp
2      // Printing multiple lines with a s...

    13 слайд

    13
    1 // Fig. 1.5: fig01_05.cpp
    2 // Printing multiple lines with a single statement
    3 #include <iostream>
    4
    5 // function main begins program execution
    6 int main()
    7 {
    8 std::cout << "Welcome\nto\n\nC++!\n";
    9
    10 return 0; // indicate that program ended successfully
    11
    12 } // end function main

    Welcome
    to
     
    C++!
    Using newline characters to print on multiple lines.

  • 1.4 VariablesVariables 
Location in memory where value can be stored
Common d...

    14 слайд

    1.4 Variables
    Variables
    Location in memory where value can be stored
    Common data types
    int - integer numbers
    char - characters
    double - floating point numbers
    Declare variables with name and data type before use
    int integer1;
    int integer2;
    int sum;
    Can declare several variables of same type in one declaration
    Comma-separated list
    int integer1, integer2, sum;
    14

  • Variables
Variable names
Valid identifier
Series of characters (letters, digi...

    15 слайд

    Variables
    Variable names
    Valid identifier
    Series of characters (letters, digits, underscores)
    Cannot begin with digit
    Case sensitive

    15
    1.4 Variables

  • 1.5 Memory ConceptsVariable names
Correspond to actual locations in computer&#039;...

    16 слайд

    1.5 Memory Concepts
    Variable names
    Correspond to actual locations in computer's memory
    Every variable has name, type, size and value
    When new value placed into variable, overwrites previous value
    Reading variables from memory nondestructive

    16

  • 1.5 Memory Conceptsstd::cin &gt;&gt; integer1;
Assume user entered 45

std::cin &gt;&gt;...

    17 слайд

    1.5 Memory Concepts
    std::cin >> integer1;
    Assume user entered 45

    std::cin >> integer2;
    Assume user entered 72


    sum = integer1 + integer2;

    17
    integer1
    45
    integer1
    45
    integer2
    72
    integer1
    45
    integer2
    72
    sum
    117

  • 1.6 Data typesC and C++ have four basic built-in data types, described here f...

    18 слайд

    1.6 Data types
    C and C++ have four basic built-in data types, described here for binary-based machines.
    char is for character storage and uses a minimum of 8 bits (one byte) of storage, although it may be larger.
    int stores an integral number and uses a minimum of two bytes of storage.
    The float and double types store floating-point numbers, usually in IEEE floating-point format. float is for single precision floating point and double is for double-precision floating point.
    18

  • 1.6 Data types19

    19 слайд

    1.6 Data types
    19

  • 1.6 Data typesSpecifiers
Specifiers modify the meanings of the basic built-in...

    20 слайд

    1.6 Data types
    Specifiers
    Specifiers modify the meanings of the basic built-in types and expand them to a much larger set. There are four specifiers:
    Long
    Short
    Signed
    Unsigned
    20
    modify the maximum and minimum values that a data type will hold.
    tell the compiler how to use the sign bit with integral types and characters (floating-point numbers always contain a sign).

  • 1.6 Data typesThe exact sizes and ranges of values for the fundamental types...

    21 слайд

    1.6 Data types
    The exact sizes and ranges of values for the fundamental types are implementation dependent.
    The range of values a type supports depends on the number of bytes that are used to represent that type.
    Consider a system with 4 byte (32 bits) ints.
    signed int type, the nonnegative values are in the range 0 to 2,147,483,647 (231 1).
    signed int type, the negative values are in the range 1 to 2,147,483,648 (231).
    unsigned int on the same system would use the same number of bits to represent data, but would not represent any negative values.
    21
    This is a total of 232 possible values
    values in the range 0 to 4,294,967,295 (232 1)

  • 1.6 C++ Data TypesThe guaranteed 
minimum range for 
each type as 
specified...

    22 слайд

    1.6 C++ Data Types
    The guaranteed
    minimum range for
    each type as
    specified by the
    ANSI/ISO C++
    standard


    22

  • 1. C++ Data Types2360,000 is within the range of an unsigned short int,  but...

    23 слайд

    1. C++ Data Types
    23
    60,000 is within the range of an unsigned short int, but is typically outside the range of a signed short int . Thus, it will be interpreted as a negative value when assigned to i.

  • 1.7      ArithmeticArithmetic calculations
* 
Multiplication 
/ 
Division
Int...

    24 слайд

    1.7 Arithmetic
    Arithmetic calculations
    *
    Multiplication
    /
    Division
    Integer division truncates remainder
    7 / 5 evaluates to 1
    %
    Modulus operator returns remainder
    7 % 5 evaluates to 2
    24

  • 1.7      ArithmeticRules of operator precedence
Operators in parentheses eval...

    25 слайд

    1.7 Arithmetic
    Rules of operator precedence
    Operators in parentheses evaluated first
    Nested/embedded parentheses
    Operators in innermost pair first
    Multiplication, division, modulus applied next
    Operators applied from left to right
    Addition, subtraction applied last
    Operators applied from left to right

    25

  • 1.7      Arithmetic26

    26 слайд

    1.7 Arithmetic
    26

  • 1.8  Decision Making: Equality and Relational Operatorsif structure
Make deci...

    27 слайд

    1.8 Decision Making: Equality and Relational Operators
    if structure
    Make decision based on truth or falsity of condition
    If condition met, body executed
    Else, body not executed
    Equality and relational operators
    Equality operators
    Same level of precedence
    Relational operators
    Same level of precedence
    Associate left to right
    27

  • 1.8  Decision Making: Equality and Relational Operators28

    28 слайд

    1.8 Decision Making: Equality and Relational Operators
    28

  • 1      //
2      // Using if statements, relational
3      // operators, and...

    29 слайд

    1 //
    2 // Using if statements, relational
    3 // operators, and equality operators.
    4 #include <iostream>
    5
    6 using std::cout; // program uses cout
    7 using std::cin; // program uses cin
    8 using std::endl; // program uses endl
    9
    10 // function main begins program execution
    11 int main()
    12 {
    13 int num1; // first number to be read from user
    14 int num2; // second number to be read from user
    15
    16 cout << "Enter two integers, and I will tell you\n"
    17 << "the relationships they satisfy: ";
    18 cin >> num1 >> num2; // read two integers
    19
    20 if ( num1 == num2 )
    21 cout << num1 << " is equal to " << num2 << endl;
    22
    23 if ( num1 != num2 )
    24 cout << num1 << " is not equal to " << num2 << endl;
    25
    using statements eliminate need for std:: prefix.
    Can write cout and cin without std:: prefix.
    Declare variables.
    if structure compares values of num1 and num2 to test for equality.
    If condition is true (i.e., values are equal), execute this statement.
    if structure compares values of num1 and num2 to test for inequality.
    If condition is true (i.e., values are not equal), execute this statement.
    29

  • 3026       if ( num1 &lt; num2 )
27          cout

    30 слайд

    30
    26 if ( num1 < num2 )
    27 cout << num1 << " is less than " << num2 << endl;
    28
    29 if ( num1 > num2 )
    30 cout << num1 << " is greater than " << num2 << endl;
    31
    32 if ( num1 <= num2 )
    33 cout << num1 << " is less than or equal to "
    34 << num2 << endl;
    35
    36 if ( num1 >= num2 )
    37 cout << num1 << " is greater than or equal to "
    38 << num2 << endl;
    39
    40 return 0; // indicate that program ended successfully
    41
    42 } // end function main
    Statements may be split over several lines.

  • 31Enter two integers, and I will tell you 
the relationships they satisfy: 7...

    31 слайд

    31
    Enter two integers, and I will tell you
    the relationships they satisfy: 7 7
    7 is equal to 7
    7 is less than or equal to 7
    7 is greater than or equal to 7
    Enter two integers, and I will tell you
    the relationships they satisfy: 22 12
    22 is not equal to 12
    22 is greater than 12
    22 is greater than or equal to 12

  • Readings:C++ How to Program, By H. M. Deitel
Chapter 1. Introduction to Compu...

    32 слайд

    Readings:
    C++ How to Program, By H. M. Deitel
    Chapter 1. Introduction to Computers, the Internet and World Wide Web
    Chapter 2. Introduction to C++ Programming

  • 33Thanks for your  attention!

    33 слайд

    33
    Thanks for your attention!

Получите профессию

Экскурсовод (гид)

за 6 месяцев

Пройти курс

Рабочие листы
к вашим урокам

Скачать

Скачать материал

Найдите материал к любому уроку, указав свой предмет (категорию), класс, учебник и тему:

6 671 666 материалов в базе

Скачать материал

Другие материалы

Вам будут интересны эти курсы:

Оставьте свой комментарий

Авторизуйтесь, чтобы задавать вопросы.

  • Скачать материал
    • 22.09.2020 236
    • PPTX 1.3 мбайт
    • Оцените материал:
  • Настоящий материал опубликован пользователем Дроздова Ирина Михайловна. Инфоурок является информационным посредником и предоставляет пользователям возможность размещать на сайте методические материалы. Всю ответственность за опубликованные материалы, содержащиеся в них сведения, а также за соблюдение авторских прав несут пользователи, загрузившие материал на сайт

    Если Вы считаете, что материал нарушает авторские права либо по каким-то другим причинам должен быть удален с сайта, Вы можете оставить жалобу на материал.

    Удалить материал
  • Автор материала

    Дроздова Ирина Михайловна
    Дроздова Ирина Михайловна
    • На сайте: 3 года и 4 месяца
    • Подписчики: 0
    • Всего просмотров: 70588
    • Всего материалов: 231

Ваша скидка на курсы

40%
Скидка для нового слушателя. Войдите на сайт, чтобы применить скидку к любому курсу
Курсы со скидкой

Курс профессиональной переподготовки

Экскурсовод

Экскурсовод (гид)

500/1000 ч.

Подать заявку О курсе

Курс профессиональной переподготовки

Руководство электронной службой архивов, библиотек и информационно-библиотечных центров

Начальник отдела (заведующий отделом) архива

600 ч.

9840 руб. 5600 руб.
Подать заявку О курсе
  • Этот курс уже прошли 25 человек

Курс профессиональной переподготовки

Организация деятельности библиотекаря в профессиональном образовании

Библиотекарь

300/600 ч.

от 7900 руб. от 3650 руб.
Подать заявку О курсе
  • Сейчас обучается 288 человек из 67 регионов
  • Этот курс уже прошли 852 человека

Курс повышения квалификации

Специалист в области охраны труда

72/180 ч.

от 1750 руб. от 1050 руб.
Подать заявку О курсе
  • Сейчас обучается 34 человека из 20 регионов
  • Этот курс уже прошли 157 человек

Мини-курс

Медико-педагогические аспекты обучения и тренировки

2 ч.

780 руб. 390 руб.
Подать заявку О курсе

Мини-курс

Профессиональное развитие бизнеса: стратегии и инструменты

6 ч.

780 руб. 390 руб.
Подать заявку О курсе

Мини-курс

История классической музыки от античности до романтизма

4 ч.

780 руб. 390 руб.
Подать заявку О курсе