Презентация C Programming онлайн
На нашем сайте вы можете скачать и просмотреть онлайн доклад-презентацию на тему C Programming абсолютно бесплатно. Урок-презентация на эту тему содержит всего 103 слайда. Все материалы созданы в программе PowerPoint и имеют формат ppt или же pptx. Материалы и темы для презентаций взяты из открытых источников и загружены их авторами, за качество и достоверность информации в них администрация сайта не отвечает, все права принадлежат их создателям. Если вы нашли то, что искали, отблагодарите авторов - поделитесь ссылкой в социальных сетях, а наш сайт добавьте в закладки.
Презентации » Устройства и комплектующие » C Programming
Оцените!
Оцените презентацию от 1 до 5 баллов!
- Тип файла:ppt / pptx (powerpoint)
- Всего слайдов:103 слайда
- Для класса:1,2,3,4,5,6,7,8,9,10,11
- Размер файла:1.89 MB
- Просмотров:83
- Скачиваний:1
- Автор:неизвестен
Слайды и текст к этой презентации:
№3 слайд
![Introduction First, it is](/documents_6/c2c99e55f8aaad500e13f27026401476/img2.jpg)
Содержание слайда: Introduction
First, it is natural to think of your data (employee records, for example) and what you can do with your data (sort, edit, and so on) as related ideas.
Second, programmers found themselves constantly reinventing new solutions to old problems.
Event-driven
means that an event happens--the user presses a button or chooses from a menu--and the program must respond.
№5 слайд
![C and Object-Oriented](/documents_6/c2c99e55f8aaad500e13f27026401476/img4.jpg)
Содержание слайда: C++ and Object-Oriented Programming
C++ fully supports object-oriented programming, including the four pillars of object-oriented development: encapsulation, data hiding, inheritance, and polymorphism.
With encapsulation, we can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally.
№6 слайд
![C and Object-Oriented](/documents_6/c2c99e55f8aaad500e13f27026401476/img5.jpg)
Содержание слайда: C++ and Object-Oriented Programming
C++ supports the idea of reuse through inheritance.
A new type, which is an extension of an existing type, can be declared. This new subclass is said to derive from the existing type and is sometimes called a derived type.
different objects do "the right thing" through what is called function polymorphism and class polymorphism.
№7 слайд
![Creating an Executable File](/documents_6/c2c99e55f8aaad500e13f27026401476/img6.jpg)
Содержание слайда: Creating an Executable File
The steps to create an executable file are
1. Create a source code file, with a .CPP extension(txt file).
2. Compile the source code into a file with the .OBJ extension(binary file).
3. Link your OBJ file with any needed libraries to produce an executable program.
№12 слайд
![Comments----before function](/documents_6/c2c99e55f8aaad500e13f27026401476/img11.jpg)
Содержание слайда: Comments----before function
/****************************************************
Program: Hello World
File: Hello.cpp
Function: Main (complete program listing in this file)
Description: Prints the words "Hello world" to the screen
Author: Jesse Liberty (jl)
Environment: Turbo C++ version 4, 486/66 32mb RAM, Windows 3.1
DOS 6.0. EasyWin module.
*******************************************************/
№15 слайд
![Enumerated Constants This](/documents_6/c2c99e55f8aaad500e13f27026401476/img14.jpg)
Содержание слайда: Enumerated Constants
This statement performs two tasks:
1. It makes COLOR the name of an enumeration, that is, a new type.
2. It makes RED a symbolic constant with the value 0, BLUE a symbolic constant with the
value 1, GREEN a symbolic constant with the value 2, and so forth.
Every enumerated constant has an integer value.
№16 слайд
![Enumerated Constants Any one](/documents_6/c2c99e55f8aaad500e13f27026401476/img15.jpg)
Содержание слайда: Enumerated Constants
Any one of the constants can be initialized with a particular value, however, and those that are not initialized will count upward from the ones before them.
enum Color { RED=100, BLUE, GREEN=500, WHITE, BLACK=700 };
then RED will have the value 100; BLUE, the value 101; GREEN, the value 500; WHITE, the value 501; and BLACK, the value 700.
№17 слайд
![include lt iostream.h gt](/documents_6/c2c99e55f8aaad500e13f27026401476/img16.jpg)
Содержание слайда: #include <iostream.h>
#include <iostream.h>
int main()
{
enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };
Days DayOff;
int x;
cout << "What day would you like off (0-6)? ";
cin >> x;
DayOff = Days(x);
if (DayOff == Sunday || DayOff == Saturday)
cout << "\nYou're already off on weekends!\n";
else
cout << "\nOkay, I'll put in the vacation day.\n";
return 0;
}
№19 слайд
![Expressions and Statements](/documents_6/c2c99e55f8aaad500e13f27026401476/img18.jpg)
Содержание слайда: Expressions and Statements
Statements
In C++ a statement controls the sequence of execution, evaluates an expression, or does nothing (the null statement).
All C++ statements end with a semicolon, even the null statement, which is just the semicolon and nothing else.
x = a + b;
№20 слайд
![Blocks and Compound](/documents_6/c2c99e55f8aaad500e13f27026401476/img19.jpg)
Содержание слайда: Blocks and Compound Statements
Any place you can put a single statement, you can put a compound statement, also called a block.
A block begins with an opening brace ({) and ends with a closing brace (}).
Although every statement in the block must end with a semicolon, the block itself does not end with a semicolon.
A block of code acts as one statement
№22 слайд
![Operators Assignment Operator](/documents_6/c2c99e55f8aaad500e13f27026401476/img21.jpg)
Содержание слайда: Operators
Assignment Operator =
Mathematical Operators
There are five mathematical operators: addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).
Combining the Assignment and Mathematical Operators
There are self-assigned subtraction (-=), division (/=), multiplication (*=), and modulus (%=) operators as well.
№37 слайд
![Conditional Ternary Operator](/documents_6/c2c99e55f8aaad500e13f27026401476/img36.jpg)
Содержание слайда: Conditional (Ternary) Operator
Syntax for using the conditional operator:
(expression1) ? (expression2) : (expression3)
If expression1 is true, the result of the conditional expression is expression2
Otherwise, the result is expression3
This line is read as "If expression1 is true, return the value of expression2; otherwise, return the value of expression3." Typically, this value would be assigned to a variable.
№38 слайд
![int Data Type and Logical](/documents_6/c2c99e55f8aaad500e13f27026401476/img37.jpg)
Содержание слайда: int Data Type and Logical (Boolean) Expressions
Earlier versions of C++ did not provide built-in data types that had Boolean values
Logical expressions evaluate to either 1 or 0
The value of a logical expression was stored in a variable of the data type int
You can use the int data type to manipulate logical (Boolean) expressions
№40 слайд
![Logical Boolean Expressions](/documents_6/c2c99e55f8aaad500e13f27026401476/img39.jpg)
Содержание слайда: Logical (Boolean) Expressions
Logical expressions can be unpredictable
The following expression appears to represent a comparison of 0, num, and 10:
0 <= num <= 10
It always evaluates to true because 0 <= num evaluates to either 0 or 1, and 0 <= 10 is true and 1 <= 10 is true
A correct way to write this expression is:
0 <= num && num <= 10
№42 слайд
![IF an operand is a long](/documents_6/c2c99e55f8aaad500e13f27026401476/img41.jpg)
Содержание слайда: IF an operand is a long double
IF an operand is a long double
THEN the second is converted to long double
ELSE IF an operand is a double
THEN the second is converted to double
ELSE IF an operand is a float
THEN the second is converted to float
ELSE IF an operand is an unsigned long
THEN the second is converted to unsigned long
ELSE IF an operand is long
THEN the second is converted to long
ELSE IF an operand is unsigned int
THEN the second is converted to unsigned int
№44 слайд
![The Comma Operator The comma](/documents_6/c2c99e55f8aaad500e13f27026401476/img43.jpg)
Содержание слайда: The Comma Operator
The comma operator strings together several expressions. The left side of the comma operator is always evaluated as void. This means that the expression on the right side becomes the value of the total comma-separated expression.
x = (y=3, y+1);
What is the value of x?
№45 слайд
![Bitwise Operators Bitwise](/documents_6/c2c99e55f8aaad500e13f27026401476/img44.jpg)
Содержание слайда: Bitwise Operators
Bitwise operation refers to testing, setting, or shifting the actual bits in a byte or word, which correspond to the char and int data types and variants.
The operations are applied to the individual bits of the operands.
the bitwise operations can be used to mask off certain bits, such as parity.
№48 слайд
![The bitwise OR, as the](/documents_6/c2c99e55f8aaad500e13f27026401476/img47.jpg)
Содержание слайда: The bitwise OR, as the reverse of AND, can be used to set a bit.
An exclusive OR, usually abbreviated XOR, will set a bit on if and only if the bits being compared are different.
The bit-shift operators, >> and <<, move all bits in a value to the right or left as specified.
№68 слайд
![Using Pseudocode to Develop,](/documents_6/c2c99e55f8aaad500e13f27026401476/img67.jpg)
Содержание слайда: Using Pseudocode to Develop, Test, and Debug a Program
Pseudocode (pseudo): provides a useful means to outline and refine a program before putting it into formal C++ code
You must first develop a program using paper and pencil
On paper, it is easier to spot errors and improve the program
Especially with large programs
№69 слайд
![Input Failure and the if](/documents_6/c2c99e55f8aaad500e13f27026401476/img68.jpg)
Содержание слайда: Input Failure and the if Statement
If input stream enters a fail state
All subsequent input statements associated with that stream are ignored
Program continues to execute
May produce erroneous results
Can use if statements to check status of input stream
If stream enters the fail state, include instructions that stop program execution
№70 слайд
![Confusion Between and C](/documents_6/c2c99e55f8aaad500e13f27026401476/img69.jpg)
Содержание слайда: Confusion Between == and =
C++ allows you to use any expression that can be evaluated to either true or false as an expression in the if statement:
if (x = 5)
cout << "The value is five." << endl;
The appearance of = in place of == resembles a silent killer
It is not a syntax error
It is a logical error
№73 слайд
![switch Structures continued](/documents_6/c2c99e55f8aaad500e13f27026401476/img72.jpg)
Содержание слайда: switch Structures (continued)
One or more statements may follow a case label
Braces are not needed to turn multiple statements into a single compound statement
The break statement may or may not appear after each statement
switch, case, break, and default are reserved words
№75 слайд
![Terminating a Program with](/documents_6/c2c99e55f8aaad500e13f27026401476/img74.jpg)
Содержание слайда: Terminating a Program with the assert Function
Certain types of errors that are very difficult to catch can occur in a program
Example: division by zero can be difficult to catch using any of the programming techniques examined so far
The predefined function, assert, is useful in stopping program execution when certain elusive errors occur
№76 слайд
![The assert Function continued](/documents_6/c2c99e55f8aaad500e13f27026401476/img75.jpg)
Содержание слайда: The assert Function (continued)
Syntax:
expression is any logical expression
If expression evaluates to true, the next statement executes
If expression evaluates to false, the program terminates and indicates where in the program the error occurred
To use assert, include cassert header file
№77 слайд
![The assert Function continued](/documents_6/c2c99e55f8aaad500e13f27026401476/img76.jpg)
Содержание слайда: The assert Function (continued)
assert is useful for enforcing programming constraints during program development
After developing and testing a program, remove or disable assert statements
The preprocessor directive #define NDEBUG must be placed before the directive #include <cassert> to disable the assert statement
№78 слайд
![Programming Example Cable](/documents_6/c2c99e55f8aaad500e13f27026401476/img77.jpg)
Содержание слайда: Programming Example: Cable Company Billing
This programming example calculates a customer’s bill for a local cable company
There are two types of customers:
Residential
Business
Two rates for calculating a cable bill:
One for residential customers
One for business customers
№79 слайд
![Programming Example Rates For](/documents_6/c2c99e55f8aaad500e13f27026401476/img78.jpg)
Содержание слайда: Programming Example: Rates
For residential customer:
Bill processing fee: $4.50
Basic service fee: $20.50
Premium channel: $7.50 per channel
For business customer:
Bill processing fee: $15.00
Basic service fee: $75.00 for first 10 connections and $5.00 for each additional connection
Premium channel cost: $50.00 per channel for any number of connections
№82 слайд
![Programming Example Program](/documents_6/c2c99e55f8aaad500e13f27026401476/img81.jpg)
Содержание слайда: Programming Example: Program Analysis
Purpose: calculate and print billing amount
Calculating billing amount requires:
Customer for whom the billing amount is calculated (residential or business)
Number of premium channels to which the customer subscribes
For a business customer, you need:
Number of basic service connections
Number of premium channels
№84 слайд
![Programming Example Algorithm](/documents_6/c2c99e55f8aaad500e13f27026401476/img83.jpg)
Содержание слайда: Programming Example: Algorithm Design
Set precision to two decimal places
Prompt user for account number and customer type
If customer type is R or r
Prompt user for number of premium channels
Compute and print the bill
If customer type is B or b
Prompt user for number of basic service connections and number of premium channels
Compute and print the bill
№87 слайд
![Programming Example Formulas](/documents_6/c2c99e55f8aaad500e13f27026401476/img86.jpg)
Содержание слайда: Programming Example: Formulas (continued)
Billing for business customers:
if (numOfBasicServConn <= 10)
amountDue = BUS_BILL_PROC_FEES +
BUS_BASIC_SERV_COST
+ numOfPremChannels *
BUS_COST_PREM_CHANNEL;
else
amountDue = BUS_BILL_PROC_FEES +
BUS_BASIC_SERV_COST
+ (numOfBasicServConn - 10)
* BUS_BASIC_CONN_COST
+ numOfPremChannels *
BUS_COST_PREM_CHANNEL;
№88 слайд
![Programming Example Main](/documents_6/c2c99e55f8aaad500e13f27026401476/img87.jpg)
Содержание слайда: Programming Example: Main Algorithm
Output floating-point numbers in fixed decimal with decimal point and trailing zeros
Output floating-point numbers with two decimal places and set the precision to two decimal places
Prompt user to enter account number
Get customer account number
Prompt user to enter customer code
Get customer code
№90 слайд
![Programming Example Main](/documents_6/c2c99e55f8aaad500e13f27026401476/img89.jpg)
Содержание слайда: Programming Example: Main Algorithm (continued)
If customer code is b or B,
Prompt user to enter number of basic service connections
Get number of basic service connections
Prompt user to enter number of premium channels
Get number of premium channels
Calculate billing amount
Print account number and billing amount
№94 слайд
![for Loops The syntax for the](/documents_6/c2c99e55f8aaad500e13f27026401476/img93.jpg)
Содержание слайда: for Loops
The syntax for the for statement is as follows:
for (initialization; test; action ) statement;
for (counter = 0; counter < 5; counter++)
A for loop works in the following sequence:
1. Performs the operations in the initialization.
2. Evaluates the condition.
3. If the condition is TRUE, executes the action statement and the loop.
№102 слайд
![Summary continued Two](/documents_6/c2c99e55f8aaad500e13f27026401476/img101.jpg)
Содержание слайда: Summary (continued)
Two selection structures: one-way selection and two-way selection
The expression in an if or if...else structure is usually a logical expression
No stand-alone else statement in C++
Every else has a related if
A sequence of statements enclosed between braces, { and }, is called a compound statement or block of statements
Скачать все slide презентации C Programming одним архивом:
Похожие презентации
-
Programming Introduction
-
Programming languages
-
EVerge Programming Workshop
-
Mathematical functions, characters, and strings. Introduction to Java Programming
-
Система программирования PascalABC. NET и электронный задачник Programming Taskbook
-
Первая программа в среде NXT 2. 1 Programming
-
Ruby programming language
-
Generations of programming language
-
Programming Languages. Compilers. Formal Languages
-
Programming In Haskell. Определение функций