Lecture 10---Programming of NC
- 格式:ppt
- 大小:303.50 KB
- 文档页数:10
1We have learned that all computers have similar capabilities and perform essentially the same functions, although some might be faster than others. We have also learned that a computer system has input, output, storage, and processing components; that th e processor is the “intelligence” of a computer system; and that a single computer system may have several processors. We have discussed how data are represented inside a computer system in electronic states called bits. We are now ready to expose the inner workings of the nucleus of the computer system — the processor.我们已经知道,所有的计算机都具有相似的能力,并且在本质上执行相同的功能,尽管一些可能会比另一些快一点。
我们也知道,一个计算机系统具有输入,输出,存储和处理部件;处理器是一个计算机系统智能核心,并且一个计算机系统可以有许多个处理器。
我们已经讨论过如何在计算机系统内部,用被称作“位”的电子状态来表现数据,现在我们要弄明白计算机系统的核心,即处理器,的内在的工作方式。
The internal operation of a computer is interesting, but there really is no mystery to it. The mystery is in the minds of those who listen to hearsay and believe science-fiction writer. The computer is a nonthinking electronic device that has to be plugged into an electrical power source, just like a toaster or a lamp.计算机的内部操作很有意思,但确实没有什么神秘可言。
Unit 10 Program DesignText 1 Computer LanguagesComputer languages have undergone dramatic evolution since the first electronic computers were built. Early on, programmers worked with the most primitive computer instructions—machine language. These instructions were represented by long strings of ones and zeroes. Soon, assembly language was invented. It maps machine instructions to human-readable mnemonics, such as ADD and MOV.In time, higher-level languages evolved, such as PASCAL, BASIC, COBOL, C, C++, and JA V A. These languages let people work with something approximating words and sentences, such as Let I = 100. These instructions were translated back into machine language by interpreters and compilers. An interpreter translates a program as it reads it, turning the program instructions, or code, directly into actions. A compiler translates the code into an intermediary form. This step is called compiling, and produces an object file. The compiler then invokes a linker, which turns the object file into an executable program.Because interpreters read the code as it is written and execute the code on the spot, interpreters are easy for the programmer to work with. Compilers, however, introduce the extra steps of compiling and linking the code, which is inconvenient. Because the time-consuming task of translating the source code into machine language has already been accomplished, compilers produce a program that is very fast each time it is run.The problems programmers are asked to solve have been changing. Today's programs use sophisticated "user-friendly interfaces," involving multiple windows, menus, and dialog boxes. The programs written to support this new approach are far more complex than those written just ten years ago. Generally, as programming requirements have changed, both languages and the techniques used for writing programs have evolved.参考译文计算机语言自从第一批电子计算机诞生以来,计算机语言已经发生了戏剧性的变化。
C# 编程语言概述外文文献翻译(含:英文原文及中文译文)文献出处:Barnett M. C# Programming Language Overview [J]Lecture Notes in Computer Science, 2016, 3(4):49-59.英文原文C# Programming Language OverviewBarnett M1. History of C, C++, C#The C# programming language is based on the spirit of the C and C++ programming languages. This account has powerful features and an easy-to-learn curve. It cannot be said that C# is the same as C and C++, but because C# is built on both, Microsoft has removed some features that have become more burdensome, such as pointers. This section looks at C and C++ and tracks their development in C#.The C programming language was originally defined in the UNIX operating system. In the past, we often wrote some UNIX applications, including a C compiler, and finally used to write UNIX itself. It is generally accepted that this academic competition extends to the world that contains this business. The original Windows API was defined to work with C using Windows code, and until now at least the core Windows operating system APIS maintains the C compiler.From a defined point of view, C lacks a single detail, like thelanguage Smalltalk does, and the concept of an object. Y ou will learn more about the contents of the object. In Chapter 8, "Write Object-Oriented Code," an object is collected as a data set and some operations are set. The code can be completed by C, but the concept of the object cannot be Forced to appear in this language. If you want to construct your code to make it like an object, that's fine. If you don't want to do this, C will really not mind. The object is not an intrinsic part. Many people in this language did not spend a lot of time in this program example. When the development of object-oriented perspectives began to gain acceptance, think about the code approach. C++ was developed to include this improvement. It is defined to be compatible with C (just as all C programs are also C++ programs and can be compiled by a C++ compiler) The main addition to the C++ language is to provide this new concept. C++ additionally provides a derivative of the class (object template) behavior.The C++ language is a modified version of the C language. Unfamiliar, infrequent languages such as VB, C, and C++ are very low-level and require a lot of coding to make your application run well. Reason and error checking. And C++ can be handled in some very powerful applications, the code works very smoothly. The goal is set to maintain compatibility with C. C++ cannot break the low-level features of C.Microsoft defined C# retains a lot of C and C++ statements. The code can also want to identify the code quickly. A big advantage for C# is that its designers did not make it compatible with C and C++. When this may seem like a wrong treatment, it is actually good news. C# eliminates something that makes C and C++ difficult to work with. Beginning with quirks and defects found in C. C# is starting a clean slate and does not have any compatibility requirements. So it can maintain the strengths of its predecessors and discard weaknesses that make C and C++ programs difficult to survive.2. Introduce C#C#, the new language introduced in the .NET system, is derived from C++. However, C# is a popular, object-oriented (from beginning to end) type-safe language.Language featuresThe following section provides a quick perspective on some of the features of the C# language. If some of them are unfamiliar to you, don't worry, everything will be explained in detail in the following sections. In C#, all code and data must be attached to a class. Y ou cannot define a variable outside the class, nor can you write any code that is not in the class. When a class object is created and run, the class is constructed. When the object of the class is released, the class is destroyed. The class provides single inheritance, and all the classes eventually get from thebase class is the object. Over time, C# provides versioned techniques to help with the formation of your classes to maintain code compatibility when you use code from your earlier classes.Let's look at an example of a class called Family. This class contains two static fields to hold the first and last names of family members. In the same way, there is a way to return the full name of a family member.Class Class1{Public string FirstName;Public string LastName;Public string FullName(){}Return FirstName + LastName;}Note: Single inheritance means that a C# class can only inherit from a base class.C# is a collection that you can package your class into a namespace called the namespace class. And you can help arrange collection of classes on logical aggregations. When you started learning C#, it was clear that all namespaces were related to .NET type systems. Microsoft also chose to include channels that assist in the compatibility of previouscode and APIs. These classes are also included in Microsoft's namespace.Type of dataC# lets you work with two types of data: value types and reference types. The value type holds the actual value. The reference type saves the actual value stored elsewhere in the memory. Raw data types, such as character, integer, float, enumeration, and structure types, are all value types. Objects and array types are treated as reference types. C# predefines reference types (objects and strings) New, Byte, Unsigned Short, Unsigned Integer, Unsigned Long, Float, Double-Float, Boolean, Character, and The value type and reference type of the decimal type will eventually be executed by a primitive type object. C# also allows you to convert a value or a type to another value or a type. Y ou can use an implicit conversion strategy or an explicit conversion strategy. Implicit conversion strategies are always successful and do not lose any information (for example, you can convert an integer to a long integer without losing any information because long integers are longer than integers) Some data is lost because long integers can hold more value than integers. Conversion occurs.Before and after referenceRefer to Chapter 3 "Working with V ariables" to find out more about explicit and implicit conversion strategies.Y ou can use single-dimensional and multidimensional arrays in C#at the same time. Multidimensional arrays can become a matrix. When this matrix has the same area size as a multidimensional array. Or jagged, when some arrays have different sizes.Classes and structures can have data members called attributes and fields. Y ou can define a structure called Employee. For example, there is a field called Name. If you define an Employee type variable called CurrenrEmployee, you can retrieve the employee's name by writing . What should happen after the code assignment? If the employee's name must be read by a database, for example, you can write a code "When some people ask for the value of the name attribute, read the name from the database and return the name with the string type".FunctionA function is a code that can be used at any time, code. An example of a function will appear earlier than the FullName function, in this chapter, in the Family class. A function is usually combined with some code that returns information, and a method usually does not return information. However, for us, we generally attribute them to functions.The function can have four parameters:•The input parameters have values passed into the function, but the function cannot change their values.•The output parameters have no value when they are passed to thefunction, but the function can give them a value and pass the value back to its caller. ,•The reference parameter passes another value by reference. They have a value into the function, and this value can be changed in the function.•The parameter parameter defines an array variable in the list.C# and CLR work together to provide automatic storage management. Or "Leave enough space for this object to use" code like this. The CLR monitors your memory usage and automatically retrieves it when you need it.C# provides a large number of operators that allow you to write a large number of mathematical and bitwise expressions. Many (but not all) of them can be redefined, and you can change the job of these operators.C# provides a long list of reports that you can define through a variety of processing paths through your code. Through the report's operations, using keywords like switch, while, for, break, and continue enables your code to be split into different paths depending on the value of the variable.Classes can contain code and data. Visibility of each member to other objects. C# provides such accessible ranges as public, protected, internal, protected internal, and private.V ariableV ariables can be defined as constants. The constant has a fixed value and cannot be changed during the execution of your code. The value of PI, for example, is a good example of a constant because her value will not be changed while your code is running. The enumeration type defines a specific name for the constant. For example, you can define an enumerated type of planet using Mercury V in your code. If you use a variable to represent the planet, using the names of this enum type can make your code easier to read.C# provides an embedded mechanism to define and handle some events. If you write a class that performs a long operation, you may want to call an event. When the event ends, the client can sign this time and grab the event in their own code, he can let them be notified When you have completed this long budget, this event handling mechanism uses delegates in C#, a variable that references a function.Note: Event processing is a program in your code that determines what action will take place when a time occurs.For example, the user clicks on a button. If your class holds a value, write some code called a protractor that your class can be accessed as if it were an array. Suppose you write a class called Rainbow. For example, it contains a set of colors in this rainbow. Visitors may want some MYRainbow to retrieve the first color in the rainbow. Y ou can write an indexer in your Rainbow class to define what will be returned when thevisitor accesses your class as if it were an array of values.InterfaceC# provides an interface that aggregates properties, methods, and events that describe a set of functions. The class of C# can execute the interface. It tells the user through the interface a set of function files provided by this class. What existing code can have as few compatibility issues as possible. Once there was an interface exposed, it could not be changed, but it could evolve through inheritance. C# classes can perform many interfaces, even if the class can only inherit from a base class.Let's look at an example of a very clear rule in the real world of C# that helps illustrate the interface. Many applications use the additions provided today. There is the ability to read additional items when executed. To do this, this added item must follow some rules. DLL add items must display a function called CEEntry. And you must use CEd as the beginning of the DLL file name. When we run our code, it scans the directories of all the DLLs that are starting with CEd. When it finds one, it is read. Then it uses GetProcAddress to find the CEEntry function in the DLL. This proves that it is necessary for you to obey all the rules to establish an addition. This kind of creating a read addition is necessary because it carries more unnecessary code responsibility. If we use an interface in this example, your DLL additions can be applied to an interface. This ensures that all necessary methods, properties, and eventsappear in the DLL and are specified as files.AttributesThe attribute declares additional information about your class for the CLR. In the past, if you wanted to describe your classes yourself, you would have to use a few decentralized ways to store them in external files, such as IDL or event HTML files. Through your efforts, the property solves this problem. The developer has constrained some information in the class and any kind of information, for example, in the class, defines how it acts when it is used. The possibilities are endless, which is why Microsoft will contain a lot of predefined attributes in the .NET framework.Compile C#Running your C# code generates two important types of information through the C# compiler: code and metadata. The next section describes these two topics and completes a binary review built on .NET code, which is assembly.Microsoft Intermediate Language (MSIL)The code output by the C# compiler is written in an intermediate language called Microsoft. MSIL is your code that is used to construct a detailed set of instructions to guide you on how to perform. It contains instructions for operations, such as initialization of variables, methods for evoking objects, error handling, and declaring something new. C# is notjust a language from the MSIL source code that changes during the writing process. All .NET-compatible languages, including and C++ management, generate MSIL when their source code is compiled. All .NET languages use the same runtime, so code from different languages and different compilers can easily work together.For physical CPUs, MISL is not a set of explicit instructions. It doesn't know anything about your machine's CPU, and your machine doesn't know anything about MSIL. Then, when your CPU can't read MSIL, explain the code. This sinking is called just enough to write, or JIT. The job of the JIT compiler is to translate your universal MSIL code to the machine so that the CPU can execute your code.Y ou may want to know what an extra step is in the process. When a compiler can immediately generate CPU-interpreted code for why MSIL was generated, the compiler does this later. There are many reasons for this. First, MSIL makes it easier for you to write code as it moves to a different piece of hardware. Suppose you have written some C# code and you want it to run on your desktop and handheld devices at the same time. It is very likely that these two devices have different CPUs. If you only have one C# compiler whose goal is a clear CPU, then you need two C# compilers: one with the desktop CPU and the other with the handheld device CPU. Y ou have to compile your code twice to ensure that your correct code is used on the right device. With MSIL, you only write once.The .NET Framework is installed on your desktop and it contains a JIT compiler that translates your MSIL-specific CPU code to your machine. The .NET Framework is installed on your handheld device and it contains a JIT compiler that translates the same MSIL-specific CPU-specific code to your handheld device. To run MSIL code base on any device that has a .NET JIT compiler. Y ou now have only one MSIL basic code that can run on any device that has a .NET JIT compiler. The JIT compiler on these devices can take care of your code and make them run smoothly.Another reason why the compiler uses MSIL is that the settings of the instruction can be easily read by an authenticated proximity. Part of the compiler's job is to verify your code to make it as clear as possible. When properly accessed, these checks ensure that your code does not execute any instructions that can cause your code to crash. The definition of MSIL directives makes this check process easier to understand. CPU-specific instruction settings are optimized for fast code execution. However, they make the code difficult to read and therefore difficult to check. Having a C# compiler that can output CPU-specific code at once can make code inspection difficult or even impossible. Allow the .NET Framework's JIT compiler to verify your code to ensure that your code accesses memory through a buggy path and that the variable types are used correctly.MetadataThe assembly process outputs the same amount of metadata. This is a very important part of the .NET code sharing story. Whether you use C# to build a client application or use C# to build a library that some people use for your application, you will want to take advantage of some compiled .NET code. That code may have been provided by Microsoft as part of the .NET framework, or it may be provided by some online users. The key to using a foreign code is to let the C# compiler know that the class and that variable are in another base code so that it can be found in the precompilation of your work and match the code you write with the source code.Look at the metadata for the directory for your compiled code. The number of bits of source code compiled by C# exists in the compiled code along with the generation of MSIL. The types of methods and variables are completely described in the metadata and are ready to be read by other applications. For example, can read metadata from a .NET library to provide intelligent sensing of all the methods that can be used effectively for a particular class.If you have already worked with COM, you may be familiar with type libraries. The goal of the type library is to provide the same directory functionality to COM objects. However, the type library is provided from a few limitations, and in fact not all data about the target can be put into the type library. Metadata in .NET does not have this disadvantage. Allthe code used to describe the class's information is placed in the metadata.memberSometimes you need to use C# to build a terminal application. These applications are packaged into an executable file and use .EXE as an extension. C# completely supports the creation of .EXE files. However, there are also times when you do not want to be used in other programs. Y ou may want to create some useful C# classes, such as a developer who wants to use your class in a application. In this case, you will not create an application, instead you will build a component. A component is a metadata package. As a unit to configure, these classes will share the same level of version control, security information, and dynamic requirements. Think of a component as a logical DLL. If you are familiar with Microsoft's translation services or COM+, then you can think of components as equivalent to .NET packages.There are two kinds of components: private components and global components. When you build your own component, you don't need to specify whether you want to create a global component or a private component. Y ou can only make your code accessible by a separate application. Y our component is a package similar to a DLL and is installed into the same directory when your application runs it. The application is only executable when it is in the same directory as yourcomponent.If you want to share your code, more global components in more applications. Global components can be used by any system's .NET application regardless of the directory in which it is installed. Microsoft installs components as part of the .NET structure, and each Microsoft component is installed as a global component. The Microsoft Architecture SDK contains the public functionality to install and remove artifacts from global widget storage.C# can be viewed to some extent as a programming language for the .NET Windows-oriented environment. In the past ten years, although VB and C++ have finally become very powerful languages, some of the content has come. For Visual Basic, its main advantage is that it is easy to understand. Many programming tasks are easy to accomplish and basically hide the connotations of the Windows API and the COM component structure. The downside is that Visual Basic has never implemented an early version of object-oriented, real-world (BASIC is primarily intended to make beginners easier to understand than to write large commercial applications), so it cannot really be structured or object-oriented. Programming language.On the other hand, C++ has its own root in the ANSI C++ language definition. It is not fully compatible with ANSI because Microsoft wrote the C++ compiler before the ANSI definition was standardized, but it isalready quite close. Unfortunately, this leads to two problems. First, ANSI C++ was developed under technical conditions more than a decade ago, so it does not support current concepts (such as Unicode strings and generating XML documents), and some of the older grammatical structures were designed for previous compilers ( For example, the declaration and definition of member functions are separate.) Second, Microsoft also tried to evolve C++ into a language for performing high-performance tasks on Windows - avoiding the addition of large numbers of Microsoft-specific keywords and libraries in the language. The result is that in Windows, the language becomes a very messy language. Let a C++ developer talk about how many strings are defined in this way: char*, LPTSTR, (MFC version), CString (WTL version), wchar_t*, OLECHAR*, and so on.Now entering the .NET era - a new environment, it has made new extensions to both languages. Microsoft added many Microsoft-specific keywords to C++ and evolved VB to , retaining some basic VB syntax, but it is completely different in design. From a practical application perspective, is a New language. Here, Visua l C# .NET. Microsoft describes C# as a simple, modern, object-oriented, type-safe, and C and C++-derived programming language. Most in dependent commentators are “derived from C, C++, and Java” from their claims. C# is very similar to C++ and Java. It uses parentheses ({})to mark blocks of code, and semicolons separate lines of statements. The first impression of C# code is that it is very similar to C++ or Java code. But after these seeming similarities, C# is much easier to learn than C++ but harder than Java. Its design and modern development tools are more adaptable than other languages. It also has Visua Basic's ease of use, high performance, and low memory accessibility of C++. C# includes the following features:●Full support for class and object-oriented programming, including interface and inheritance, virtual functions, and operator overloading.●Define a complete, consistent set of basic types.●Built-in support for automatically generating XML document descriptions.●Automatically clean dynamically allocated memory.●Classes or methods can be marked with user-defined properties. This can be used for documentation purposes and has a certain impact on compilation (for example, marking a method to compile only when debugging).●Full access to the .NET base class library and easy access to the Windows API.●Y ou can use pointers and direct memory access, but the C# language can access memory without them.●Supports attributes and events in VB style.●Changing compiler options, ActiveX controls (COM components) are called by other code in the same way. ●C# can be used to write dynamic Web pages and XML Web services.It should be noted that for most of these features, and Managed C++ are also available. But since C# used .NET from the beginning, support for .NET features was not only complete, but also provided a more suitable syntax than other languages. The C# language itself is very similar to Java, but there are some improvements because Java is not designed for use in a .NET environment. Before ending this topic, we must also point out two limitations of C#. One is that the language is not suitable for writing time-critical or very high-performance codes, such as a loop that runs 1000 or 1050 times, and immediately clears the resources they occupy when they are not needed. In this regard, C++ may still be the best of all low-level languages. The second is that C# lacks the key functions needed for very high-performance applications. The parcels guarantee inlining and destructor functions in specific areas of the code. However, such applications are very few.中文译文C# 编程语言概述作者:Barnett M1. C,C++,C#的历史C#程序语言是建立在C 和C++程序语言的精神上的。
Software Development MethodologyData Modeling and Review Lecture 10Lecturer:罗铁坚 Email: tjluo@ Phone: 88256308 ----------------------------------------------------------------Class Time: Mon / Wed 10:00am – 11:40am Office Hour:Friday Morning 10:00 – 12:00 Office Place:玉泉路教学园区科研楼东5层511SDM 2012Conceptual Data Modeling 1. Requirement Determination 2. Structure System Requirement 3. Conceptual Data Modeling 4. Object-Rational Modeling 5. Analysis ClassesSDM 20122Objectives• After studying this part you should be able to:– Determine how to develop conceptual data models from use cases. – Understand UML notations for conceptual data modeling. – Explain relationship characteristics such as degree and multiplicity.SDM 20123Objectives (Continued)• After studying this part you should be able to:– Describe data relationships such as association, aggregation, and generalization. – Describe different kinds of attributes such as identifier, multivalued, and derived.SDM 20124There are three prominent parts of a system's model • Functional model– Showcases the functionality of the system from the user's point of view. – Includes use case diagrams.• Object model– Showcases the structure and substructure of the system using objects, attributes, operations, and relationships. – Includes class diagrams.• Dynamic model– Showcases the internal behavior of the system. – Includes sequence diagrams, activity diagrams and state machine diagrams.SDM 20125UML 2.0 DiagramsSDM 20126SDM 20127SDM 20128Concepts • For structure– Actor, attribute, class, component, interface, object, package.• For behavior– Activity, event, message, method, operation, state, use case.• For relationships– Aggregation, association, composition, depends, generalization (or inheritance).• Other concepts– Stereotype. It qualifies the symbol it is attached to. – Multiplicity notation which corresponds to Database modeling cardinality, e.g., 1, 0..1, 1..* 9 SDM 2012 – RoleWhat Is a Conceptual Data Model?• A detailed model that shows the overall structure of organizational data; it is independent of any database management system or other implementation considerations. • Represented by UML class diagramsSDM 201210Use cases are key inputs to conceptual data modeling.Conceptual Data Model Elements •Classes•Attributes•Identifiers•Associations, aggregations, compositions •Generalizations•Time dimensions•Integrity rules•Security controlsWhat Is an Object?•An entity that encapsulates data and behavior•Examples: product, employee, order, line item•Class–a set of objects that share the same attributes, operations, relationships, and semantics (abstract)•Instance–a single object (concrete)ClassInstancesUML Class symbol has three parts:1)Name2)List of attributes3)List of operationsTypes of Attributes •Simple attributes –contain single data item •Identifiers –connect unique key value •Multivalued attributes –contain multiple values simultaneously•Composite attributes –group of related attributesStereotypes in Class Diagrams •Stereotype –a construct that extends the UML vocabulary•<<PK>>for Identifier stereotypeprimary key•Multivalued stereotype<<multivalued>>Primary key is a unique identifier; no two Student instances will have the same studentId value.Multivalued attribute can contain multiple values; a student may have several phone numbersWhat Is a Relationship?•A semantic connection between objects of one or more classes•In UML, represented as a line connecting two or more class boxes (or connecting one class to itself)They are treated as separate classes in conceptual data models.This is a binary relationship, which indicates that an employee works in a department.Roles identify the purpose of each class in the relationship.What Is Relationship Degree?•The number of classes that participate in a relationship•Main degrees:–Unary –a relationship between objects of thesame class–Binary –a relationship between objects of twodifferent classes–Ternary –a relationship between objects of threedifferent classesWhat Is Relationship Multiplicity?•The range of the number of objects in Class A that can or must be associated with each object of Class B.•A multiplicity is made up of:–A minimum cardinality –the minimum number ofClass A objects possible–A maximum cardinality –the maximum number ofClass A objects possibleRelationship Multiply •Relationships can be:–One –to –one–One –to –many–Many –to –manyMultiplicity notation is: min..maxRoles make it clearer to see which should be on the one side and which should be on the many side of the relationship.What Is an Associative Class?•A special purpose class that represents an association (relationship) between classes and contains attributes and/or relationships in its own right•Represented as a class connected to an association with a dotted lineA Certificate represents a relationship between an employee and a course, and has an attribute pertaining to that relationshipSometimes associative classes have their own relationships with other classes.Types of Associations Association–no object is subordinate to any other.Aggregation–one class represents the whole, and the other represents the part, but it is a loose coupling.Composition–an aggregation with a tight coupling. The whole and the part cannot exist without each other.What Is Generalization?•A superclass –subclass relationship in which one class forms a broader category in which the other class is a sub-category•Inheritance–A subclass will inherit all the attributes and operations of its superclass; an instance of the subclass contains all the same information (plus more) as an instance of the superclass.Multiple inheritance is complicated and not supported by all object-oriented programming languages.Reviewe Case2.Data models(Your Project)3.Class diagramyer architecture (Your Project)5.Project EvaluationLayered Architecture ExampleArchitecturally Significant Use cases Reserve Room Check-In Customer Check-Out Customer Etc.Etc.More ApplicationSpecificApplication LayerCustomer ApplicationCounter ApplicationWaiting List ServiceMore ApplicationDomain LayerInfrastructureLayerReservation ManagementRoom ManagementAuthorizationPresentation Distribution PersistenceUse Cases Provides Means To Evaluate ArchitectureApplication LayerCustomer ApplicationCounter ApplicationWaiting List ServiceReserve RoomCheck-In Customer Check-Out CustomerMore ApplicationSpecificDomain LayerReservation ManagementRoom ManagementAuthorizationPresentation Distribution PersistenceMore ApplicationInfrastructureLayerConsider a simple part of a POS system as shown in the following class diagramCreate a Shopping Cart---Item Class public class Item : IFormattable{// ...public override bool Equals(object obj){if (obj == null) return false;if (Object.ReferenceEquals(this,obj))return true;if (this.GetType() != obj.GetType())return false;Item objItem = (Item)obj;if (_productID == objItem._productID)return true;return false;}// ...。
2Some Informationo Lecturingn C/C++ Language n Artificial Intelligence n Specialized Englisho Phone numbers and emailn Office: A0816n Phone: 84706003-3816n Email: eecc2012@3Textbooko 书名:C 语言教程(英文版·第4版)o 原书名:A Book on C:Programming in Co 作者:(美)Al Kelley, Ira Pohl o 出版社:China Machine Pres s4Professor of Computer and Information Scienceso Ira Pohl is a Professor of ComputerScience at the University of California, Santa Cruz.o His current research is in object-orientedprogramming(OOP) and topics in software methodology. He has written widely on programming in C, C++,C# and Java.o His research interests include artificialintelligence (AI), the C#, C, C++ and Java programming languages, practical complexity problems, heuristic search methods, etc..5Reference Readingo 书名:C 语言的科学和艺术(英文版)o 原书名:The Art andScience of C:A Library Based Introduction to Computer Science o 作者:Eric S.Robertso 出版社:China Machine Pres s6Reference Readingo 书名:C 程序设计语言(第2版·新版)o 原书名:The C ProgrammingLanguageo 作者:(美)Brian W.Kernighan,Dennis M.Ritchieo 出版社: Prentice-HallInternational , Inc.7Course administrationo Class hours :72 Credits :4n Teaching hours :48 hours (3 credits)n Practice hours :24 hours (1 credits)o Grading system :100n Final exam: 60%n Homework and Quizz: 15%n Projects: 25%Course administrationo Class is 4hours of lecture a week, Monday andWednesday at 13:30pm and 8:00amo 4 hours of practice a week ,6 weeks from 6th~11th week o 8hours a week of outside-the-class.9Why do we learn C language?o Today is the era of java and .net.oC is the fundament of OS. The kernel of Unix, Linux and Windows are written by C. Windows API is the interface of C functions. Unix/Linux applications are developed by C.oIf you want to be the superior of programmer, you must learn C language.oC# derived from C/C++What skills will you acquire?o You’re going to be able to write.o You’re going to be able to read.o Understand abilities and limits.o Understand what you can and cannot do.11How to study C programming:Some proverbso Standardization of formatn Well begun, half done.n A year ’s plan starts spring.o Have patiencen A workman must first sharpen his tools if he is to dohis work well.n Right tool for the right job.o Debug routinen Everything has a hard beginning.n Practice makes perfect.To follow, without halt, one aim:there the secret of success.12How to study C programming:o 1. Read all assigned reading in the textbook.--Not just once.--one paragraph at a time.--close the book, summarize the paragraph you just read.--If you could not summarize it quickly and accurately,read it again .o 2. Read your lecture notes in the same way.Type in all the programs you saw in class and make sure you understand them.o 3. Read the documentation of strcpy , strcat , strcmp ,malloc , calloc , strlen , printf , sprint , sscanf etc. Know how to find the documentation of any C library function and what is meant by "the documentation".o 4. Read your homework and make sure you know how itworks. The exams will definitely include several questions about the homework programs.13What I expect from you as a student:o Show up for classo Show up for class on timeo Know what the topic is for that dayo Have already read the corresponding part of the textbook (see the lecture schedule)o After the class meets, go over the material again (textbook, and notes, if any)o Do your homework (and on time!)o Do your own homework by yourself . (You can discuss it orally but you must do your own writing.)o Arrange your schedule so that you have identifiable hours each week to spend on this course.oWork at a steady pace throughout the semester instead of in frantic bursts just before the final exam.14What will we learn?o Program o Functionsn Declarationso Constant o Variablen fundamental :int, char, float, double n structured: array, struct, union n pointern Statementso assignmento control: if, for, do, while,…o compound o null150 Starting from Zero2 Lexical Element,Operators, and C System 3The Fundamental Data Types 4Flow of Control 5Functions6Arrays, Pointers and Strings7Bitwise Operators and Enumeration Types 8The preprocessor 9Structures and Unions 10Structures and List Processing11Input/Output and the Operating System13 Moving from C to C++Contents 16o Some termsn Computer language n Programn Programming n Algorithmo Program ’s Constitutionn Some representation of fundamental data n Give instructions to computer(decription of recipe)C/C++ Language17o What is the program?n data structure+algorithm=program n data structure+algorithm+structured programming method+language tool= programo Three basic structuresn Sequential n conditional n IterationC/C++LanguageNikiklaus Wirth——Computer Scientist18o 0.1 C ’s background o 0.2 C ’s Characteristic o 0.3 ANSI C Standard o 0.4 From C to C++o 0.5 From C and C++ to Java0 Starting from Zero19The basic organization of a computer system0.1 C ’s background Arithmetic sectionStorage sectionControl section Input device Output deviceresultprogramdataCPU20Machine languagesAssembly languagesHigh-level languageProcedure -oriented Object-oriented0.1 C ’s backgroundThe development of programming languages211.In the mid-1970s,UNIX spread throughout BellLabs.2.By 1980,several C compilers were put forward onthe market.3.By now,there are many versions of C languages.0.1 C ’s background The origin of C language 22True dialogueArtificial intelligence “ dialogues”Command languages(as in OS)Problem-oriented languages(Fortran, Pascal)Machine-oriented languages(BCPL,B)Assembly languagesHardware0.1 C ’s backgroundThe place of the C languageþýüþýülow-levelHigh-levelconcrete abstractdetailedgeneralpastfuture C23Algol60 (1960,an international committee)CPL (1963,Cambridge & Univ.of London)BCPL (1967, Martin Richards)B (1970, Ken Thompson)C (1972, Dennis Ritchie)0.1 C ’s background The development of the C language240.2 C ’s characteristicp C is a small language Keyword p C is the native language of Unix p C is portable Pascal p C is terse Operator p C is modularp C is the basis for C++ and Java p C is efficient on most machinesp C is not without criticism0.3 ANSI C Standard 26p C often serves as the kernel for more advanced or morespecialized languages.p C++ is an object-oriented language,it is the extension of C.0.4 From C to C++27p Java was designed for work on the Internetp It allows the programmer to write secure and portableprograms that can be downloaded from the Internet and run on your local machine.p Java borrows ideas from both C and C++ and is designed to run in a machine-and system-independent manner.0.5 From C and C++ to Java 28o Operating system o Source file o Text editor o Compiler o Object codeProgramming and preparation29We must do: 1. Edit it (*.c)2. Compile it (*.obj)3. Run it (*.exe)It depends on the system we are using.Programming and preparation 30Programming and preparation31VC++6.0Programming and preparation32“File ”→“New ”33“Files ”→“C++ Source Files ”34“File ”→“Save ”35“Build ”→“Compile test1.c ”36“Build ”→“Build test1.exe ”37“Build ”→“Execute test1.exe ”3839sea1.c#include <stdio.h>int main (){printf(“from sea to shining C\n ”);return 0;}Examplesfrom sea to shining CLibrary function 40sea2.c#include <stdio.h>void main(){printf(“from sea to ”);printf( “shining C ”);printf(“\n ”);}Examplesfrom sea to shining C41sea3.c#include <stdio.h>void main(){printf(“from sea\n ”);printf( “to shining \nC\n ”);}Examplesfrom sea to shining C42******************* from sea ** to shining C *******************43sea4.co #include <stdio.h>o void main()o {o printf("\n\n\n\n\n\n\n\n\n\n");o printf(" ******************\n");o printf(“* from sea *\n");o printf(“* to shining C *\n");o printf(" ******************\n");o printf("\n\n\n\n\n\n\n\n\n\n");o}Examples 44n miles and yards, kilometers. n Convert yards to miles, divide by 1760.0n Convert miles to kilometers, conversion factor 1.609n miles=yards/1760.0;nkilometers=1.609*miles;ExamplesIn English units, a marathon is defined to be2638542.245/* marathon .c The distance of a marathon in kilometers.*/Examples#include <stdio.h>void main(){ int miles,yards;float kilometers;miles=26;yards=385;kilometers=1.609*(miles+yards/1760.0);printf(“\nA marathon is %f kilometers.\n\n”, kilometers);}A marathon is 42.185969 kilometers.46/*The distance of a marathon in kilometers.*/Examplesp Convert the distance of a marathon in miles and yards to kilometers p int ,floatp V ariables must be declared at the beginning of the program p Identifier consists of a sequence of letters,digits,andunderscores,but may not start with a digit.p Comment p Semicolonp Assignment statement p precedence47Homeworko Write an interactive program that converts pounds andounces to kilograms and e symbolic constants that are defined at the top of the file outside of main().o 2. For a three-figure integer, get its unit's place , ten ’splace and hundred's place figure.o pute the roots of quadratic equation :ax 2+bx+c=0o 4.Input the three edges of a triangle, compute its area.o 5. Compute the BODY MASS INDEX(BMI)t= weight (kg)/height (m x m)ïïïîïïïíì³<£<£<£<II 0Obese .30 I 9Obese .9252t9Overweigh .42329Normal .225.18ht 5Underweig .18t t t t t 48Thank you!49Keywords( standard C:32)auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef unsigned union void volatile while50Keywords(C++:32)bad_cast bad_typeid bool catch classconst_cast delete dynameic_cast except explicitfinally friend inline mutable namespace new operator private protected public reinterpret-cast static_cast template this throwtrue try type-info typeid typename using virtual<51Control statements(9)if( )~else~for( )~while( )~do~while( )continue break switch goto return<52C & PascalC Pascal{ } BEGIN….END if(e) s; IF(e) THEN sint i ; VAR i:INTEGERint a[10]; VAR a:ARRAY[1..10] OF INTEGER int f(); FUNCTION f():INTEGERint *p;VAR p:-INTEGER<53Operatorsarithemetic:+ -* / % ++ --relational:< <= == > >= !=logical:!&& ||bitwise:<< >> ~ | ^ &assignment:= += -= *= /= %= &= ^= |= <<= >>=conditional:?:comma:,pointer:* &Bit count:sizeof case:(type-name)member:. ->index:[]others:( ) -<54Data TypesData typestandardstructure d pointer voidtypedefnumericchar enumintegral realfloatdoubleshort long intarraystruct union <55portableif (x>0) then BEGIN A:=1;B:= 2END;#define THEN #define BEGIN {#define := =#define END ; ;}if (x>0) {A=1;B=2;}<。
计算机专业英语教程参考答案计算机专业英语练习参考答案Unit 1[Ex 1]1..F2.T3.T4.F5.T6.T7.T8.T9.T 10.F [Ex 2]1.input, storage, processing, and output2. power, speed, memory3. central processing unit4. internal, primary, memory5. keyboard, central processing unit, main memory, monitor[Ex 3]A. 1.F 2.D 3.G 4.C 5.B 6.E 7.H 8.AB. /doc/1550f601a6c30c2259019e48.html er 2.monitor 3.data4.keyboard5.data processing6. information/doc/1550f601a6c30c2259019e48.html puter8.memory[Ex 4]1.input device2. screen, screen3.manipulates4.instructions5.retrieve6.code7.hard copy8.function/code/instruction [Ex 5]1.T2.T3.F4.F5.T6.F7.T8.FUnit 2[Ex 1]1.T2.F3.T4.F5.T6.T7.T8.F[Ex 2]1. sizes, shapes, processing capabilities2. supercomputer, mainframe computer, minicomputers, microcomputers3. mainframe computer4.microcomputers, storage locations5. portables, laptop computers/ notebook/palm-sized computer, desktop workstations6.semiconductor7. CPU, memory, storage, devices, processing, users8. microprocessor ship[Ex 3]A. 1.C 2.A 3.H 4.I 5.E 6.F 7.G 8.BB. 1.capacity 2.device /doc/1550f601a6c30c2259019e48.html ptop computer4.portable computers5.silicon6. semiconductor7.workstation8.voltage9.RAM 10.ROM[Ex 4]1. portable2.access3. main memory4.sophisticated programs5. processing capabilities6.instructions7.semiconductor /doc/1550f601a6c30c2259019e48.html putation /doc/1550f601a6c30c2259019e48.html puter professional[Ex 5]1.T2.T3.T4.F5.F6.T7.F8.T9.F 10.T 11.F 12.T 13.T 14.T Unit 3[Ex 1]1.T2.F3.T4.T5.T6.T7.F8.F9.T 10.F 11.T 12.F[Ex 2]1.microprocessor2.bus3.registers4.control unit5.processor6.binary7.arithmetic, logical/doc/1550f601a6c30c2259019e48.html liseconds, microseconds, nanoseconds.9.instruction 10.execution 11.megaherts 12.wordsize[Ex 3]A. 1.J 2.D 3.F 4.B 5.C 6.E 7.I 8.H 9.A 10.GB. 1.storage 2.chip 3.registers 4.ALU 5.bus6.control bus7.machine language8.binary system9.bits 10. computer program[Ex 4]1. configuration2. converts3.data bus4.characters5.converts6.synchronize7.circuitry8.internal clock [Ex 5]1.T2. F3.F4.T5.T6.F7.T8.T9.T 10.F Unit 4[Ex 1]1.F2.T3.T4.T5.F6.T7.F8.T9.T 10.F 11.T 12.T 13.F 14.F 15.T 16.F 17.T 18.F 19 T 20.F 21.T 22.F [Ex 2]1. main memory2.RAM3.diskettes/floppy disks; hard disks4.chips5.parity6.expanded,extended7.monochrome 8.cache 9.ROM 10.updated [Ex 3]A. 1.B 2.E 3.C 4.J 5.I 6.H 7.A 8.F 9.G 10.DB. 1.secondary storage 2.buffer 3.access4.code5.diskette6.slots7.terminals8.motherboard9.bytes 10.screen[Ex 4]1.desktop2.software3.animation4.transferred5.sophisticated/doc/1550f601a6c30c2259019e48.html patible7.cache8.upgrade[Ex 5]1.T2.F3.T4.T5.F6.T7.F8.T9.T 10.T 11.T 12.T 13.T 14.F 15.F 16.T Unit 5[Ex 1]1.T2.F .3.F4.F5.T6.T7.T8.F9.F 10.T 11.F 12.F 13.T 14.T[Ex 2]1.floppy disks2.disk drive3.revolutions4.bits5.megabytes, gigabyte, terabyte6.density7.sectors8.1.44[Ex 3]A. 1.H 2.F 3.E 4.D 5.C 6.A 7.B 8.GB. 1.read/write heads 2.read/write heads3.magnetic tape4.index5.disk drivers6.format7.clone8.tracks[Ex 4]1.increment2.spins3.activate4.specification5.magnetize6.overwrite7.contaminated8.mechnism[Ex 5]1.T2.F3.F4.F5.T6.T7.F8.T9.T 10.T 11.F 12.F 13.T 14.T 15.F 16.T 17.F 18.T 19.T 20.T Unit 6 [Ex 1]1.F2.T3.F4.T5.T6.T7.F8.T9.T 10.F 11.F 12.F 13.T 14.F[Ex 2]/doc/1550f601a6c30c2259019e48.html patible2.hardcopy3.terminal,monitor4.inked ribbon5.line6.Thernal7.Monochrone8.liquid crystal display[Ex 3]A 1.G 2.B 3.I 4.F 5.D 6.H 7.C 8.E 9.J 10.AB 1.printers 2.hard copy 3.CRT 4.hardware5.pixel6.output7.software8.Line printers9.plotters10.graphics[Ex 4]1. are attached /doc/1550f601a6c30c2259019e48.html patible3.flexible4.mechanism5.perform6.rotate7.transfer8.video[Ex 5]1.T2.T3.T4.T5.T6.F7.T8.F9.F 10.T 11.T 12.F 13.T 14.T 15.T 16.T 17.F 18.TUnit 7[Ex 1]1.T2.F3.T4.T5.F6.F7.T8.T9.F 10.F 11.F 12.T 13.F 14.T 15.T 16.F 17.T 18.T 19.F 20.F [Ex 2] 1.printers, plotters2.graphics3.pins4.pages per minute5.dots per inch6.lines per minute7.non-impact 8.carbon[Ex 3]A. 1.D 2.F 3.B 4.A 5.G .6.E 7.C 8.HB. 1.print wheel 2.Microcomputers 3.ink-jetprinter /doc/1550f601a6c30c2259019e48.html work 5.noise 6.output device 7.desktop publishing 8.dot-matrix printers[Ex 4]1.installation2.categorized3.image4.ribbon5.monochrome6.physical7.referred to8.dot [Ex 5]1.F2.T3.F4.T5.F6.T7.F 8.T9.T 10.F 11.F 12.T 13.T 14.T 15.FUnit 8[Ex 1]1.T2.T3.F4.T5.T6.T7.F8.T9.F 10.T 11.F 12.F 13.T 14.T 15.F 16.T [Ex 2]1.inputting2.dumb, smart, intelligent3.dumb4.smart5.intelligent6.point-of-sale, automated teller machine7.POS 8.terminals 9.portable 10.moderms 11.transmitted /doc/1550f601a6c30c2259019e48.html municate [Ex 3]A. 1.G 2.E 3.A 4.F 5.C 6.B 7.H 8.DB. 1display screen 2.programming3.telecommunications4.function keys5.retrive6.minicomputers7.moderm 8.automated/automatic [Ex 4]1.intelligent2.verify3.Programmable4.specialized5.identify6.built-in7.high-volume8.are transmitted[Ex 5]1.T2.T3.F4.T5.F6.T7.F8.T9.T 10.T 11.T 12.F 13.T 14.T Unit 9[Ex 1]1.T2.T3.F4.T5.F6.F7.T8.T9.F 10.F 11.T 12.F 13.T 14.F 15.T 16.T 17.T 18.F[Ex 2]1.channels2.electrical pulses or charges, electromagnetic waves, pulses of light3.telephone lines, coaxial cables, microwave systems, satellites systems, fiber optic cables4.telephone lines/doc/1550f601a6c30c2259019e48.html works6.atmosphere7.microwave tower8.gigahertz9.digital 10.light[Ex 3]A. 1.B 2.D 3.F 4.G 5.A 6.C 7.E 8.HB. 1.noise 2.trnasmission 3.Fiber optics4.Microwave5.synchronous6.optical media7.Coaxial cable8.digits[Ex 4]/doc/1550f601a6c30c2259019e48.html municate2.revolves3.detect4.encrypted5.nonconductive6.optical media7.susceptible8.relayed 9.antenna 10.pulses[Ex 5]1.F2.T3.T4.F5.T6.T7.T8.F9.T 10.T 11.F 12.T 13.T 14.T 15.F 16.T 17.T 19.F 20.T 21.F 22.TUnit 10[Ex 1]1.F2.F .3.F4.T5.T6.F7.T8.F9.T 10.T 11.F 12.F 13.T 14.T 15.T 16.F [Ex 2]1.three-dimensional2.joystick3.transmitter4.frames5.virtual[Ex 3]A. 1.C 2.G 3.D 4.H 5.B 6.F 7.A 8.EB. 1.sensors 2.virtual reality 3.software package 4.host computer 5.joystick6.mouse7.input 8.transmitter[Ex 4]1.Conveying2.responds3.incorporate4.signals5.performance6.mounted7.cumbersome8.insert[Ex 5]1.T2.f3.T4.F5.T6.T7.T8.T9.F 10.T 11.T 12.T 13.F 14.T 15.T 16.F 17.F 18.F 19.T 20.F 21.F 22.F 23.T 24.T 25.T Unit 11[Ex 1]1.F2.T3.F4.F5.T6.T7.F8.F9.T 10.T 11.F 12.T 13.F 14.T 15.T [Ex 2]1.caller2.audio boards3.directory4.clicking5.IRC[Ex 3]A. 1.F 2.A 3.G 4.B 5.H 6.C 7.I 8.D 9.J 10.EB. 1.update 2.hard disks 3.Audio boards4.directory5.menu6.ports7.download8.online9.icon 10.bug[Ex 4]1.fixes2.register3.specify4.created5.remove6.installed7.execute8.to load [Ex 5]1.T2.F3.T4.T5.F6.T7.T8.F9.T 10.F 11.T 12.F 13.T 14.TUnit 12[Ex 1]1.F2.T .3.T4.T .5.F6.F7.T8.T9.F 10.T [Ex 2]/doc/1550f601a6c30c2259019e48.html pressed 2.specify3.screen4.wide5.attributes6.optional7.directory8.subdirectories9.lowercase 10.wildcards 11.prompt 12.target[Ex 3]A. 1.H 2.D 3.G 4.C 5.F 6.B 7.E 8.AB. 1.execute 2.prompt 3.file 4.format5.backup file/doc/1550f601a6c30c2259019e48.html pressed 7.parameter8.lowercase[Ex 4]1.is displayed2.archive3.attribute4.default5.subdirectory6.extension7.abbreviated8.lowercase[Ex 5]1.T2.T3.F4.T5.T6.F 8.T 9.T 10.TUnit 13[Ex 1]1.T2.F .3.F4.T5.T6.T7.T8.F9.T 10.F 11.T 12.F 13.T 14.T 15.T 16.F 17.T 18.F 19.T 20.T [Ex 2]1.executable2.configure3.variables4.download5.double click6.performance7.explorer8.customize 9.log 10.feature[Ex 3]A. 1.A 2.F 3.B 4.G 5.C 6.D 7.E 8.HB. 1.utility program 2.documentation3.spreadsheet/doc/1550f601a6c30c2259019e48.html piled 5.virus scanner 6.configuraiotn7.features 8.Viruses[Ex 4]1.infect, being detected2.customized3.folders4.optimizes5.highlighted6.reveal7.prompt8.license[Ex 5]1.T2.F3.T4.F5.T6.T7.T8.F9.F 10.T 11.F 12.T 13.T 14.F 15.F 16.F 17.T 18.T 19.F 20.T Unit 14 [Ex 1]1.T2.F .3.T4.F5.F6.F7.T8.F9.T 10.T 11.F 12.T 13.F 14.T 15.T 16.T 17.T 18.T[Ex 2]1.duplicate2.destination3.entries/doc/1550f601a6c30c2259019e48.html pound, single-entry5.overwrite6.array7.one-dimensional8.two-dimensional 9.arrays, table/.DBF [Ex 3]A. 1.E 2.D 3.B 4.C 5.AB. 1.record 2.backup 3.field 4.tables 5.array [Ex 4]1.duplicate2.specific3.source, destination4.current5.path6.assign7.original8.dialog [Ex 5]1.F2.F3.T4.F5.F6.F7.F8.F9.F 10.F 12.F[Ex 1]1.F2.T3.T4.T5.F6.T7.T8.T9.F 10.F 11.F 12.T 13.F 14.T [Ex 2]1.browse2.sub-directory3.copyrighted4. custom-written5.unzip6.atrribute7.automatically8.decompressed[Ex 3]A. 1.F 2.G 3.H 4.C 5.D 6.A 7.B 8.EB. 1.profile 2.batch program/doc/1550f601a6c30c2259019e48.html work-aware program4.copyright5.browse6.platform7.kit8.zip[Ex 4]1.format/doc/1550f601a6c30c2259019e48.html unch3.Custom/doc/1550f601a6c30c2259019e48.html pressed5.unzip6.licensed7.test-run8.page mode [Ex 5]1.T2.F3.T4.F5.F6.F7.T8.F9.F 10.T 11.T 12.T 13.F 14.T 15.F 16.T 17.F 18.F 19.F 20.T 21.F 22.F [Ex 1]1.T2.T3.T4.F5.T6.T7.F8.T 10.F 11.T 12.F[Ex 3]1.entitled2.impractical3.paper4.major5.conveying6.eminet7.suffice8.programming language/doc/1550f601a6c30c2259019e48.html pilers 10.to lament11.coincide 12.successive[Ex 4]1.stumbled across2.were appalled at3.making4.was leveled5.analogous6.in futility7.confusion 8.is focused on [Ex 5]1.F2.T3.T4.T5.F6.F7.T8.T9.F 10.T 11.F 12.T 13.F 14.T。
C Programming Language Course Hours: LectureCourse content and the basic requirementsChapter 1C language Overview1.1 Computer and program, program design language1.2 Appearance and development process of C language1.3 Simple C language programs1.4 Steps and methods of running C programChapter 2 DData storage and computing2.1 How to store data in a computer2.2 Operations and analysis of integer data2.3 Operations and analysis of real data2.4 Calculus of character data2.5 Symbolic constant2.6 Arithmetic operators and arithmetic expression2.7 C operators and C expression2.8 Advanced PartChapter 3Most simple C program design - sequential programming3.1 Algorithm is the soul of program3.2 Three basic structure of program3.3 C statement Summary3.4 Evaluation expression and evaluation statement3.5 Concept of data input and output3.6 Character data input and output3.7 Simple format input and output3.8 Design example of sequential structured program3.9 Advanced partChapter 4Selective structure programming design4.1 Conditional determination4.2 Make selective structure with “if” statement4.3 Make selective structure of the multi-branch by using” switch” statement 4.4 Synthesize program example4.5 Advanced PartChapter 5Circle structure of the program design5.1 Required circle structures during the program5.2 Use “while” statement and “do ... while” statement to achieve circular 5.3 Used “for” statement cycle5.4 Cycle of nested5.5 Advanced ending cycle5.6 Several circle comparison5.7 Program examples5.8 Advanced partChapter 6Use of array processing bulk data6.1 Why use an array6.2 Definition and reference of one-dimensional array6.3 Definitions and reference of two-dimensional arrays of 6.4 Character array6.5 Advanced partChapter 7Function modular program design7.1 What is the function?7.2 Function definition and call7.3 Function of nested calls and recursive calls7.4 Arrays as function parameters7.5 Variable scope and lifetime7.6 Internal functions and external functions7.7 Advanced partChapter 8Good use of pointer8.1 What is a pointer?8.2 Pointer variable8.3 Refers to the array through pointers8.4 Reference to the string by a pointer8.5 Advanced partChapter 9Use syntagm to deal with combinations of data - user-defined data type 9.1 Definitions and use of the Syntagm variable9.2 Syntagm array9.3 Syntagm pointer9.4 Use syntagm variable and its pointer as function parameters9.5 Deal linked list with pointers9.6 Advanced partChapter 10Use file to save data10.1 Concept of C file10.2 File open and close10.3 File sequential read and write10.4 File random read and write10.5 Advanced partClass Hours Associate Sheet。
1.2 总线互连总线是连接两个或多个设备的通信通路。
总线的关键特征是,它是一条共享传输介质。
多个设备连接到总线上,任一个设备发出的信号可以为其他所有连接到总线上的设备所接收。
如果两个设备同时传送,它们的信号将会重叠,引起混淆。
因此,一次只能有一个设备成功地(利用总线)发送数据。
典型的情况是,总线由多条通信通路或线路组成,每条线(路)能够传送代表二进制1和0的信号。
一段时间里,一条线能传送一串二进制数字。
总线的几条线放在一起能同时并行传送二进制数字。
例如, 一个8位的数据能在8条总线线上传送。
计算机系统包含有多种不同的总线,它们在计算机系统层次结构的各个层次提供部件之间的通路。
连接主要计算机部件(处理机, 存储器, I/O)的总线称为系统总线。
系统总线通常由50~100条分立的(导)线组成。
每条线被赋予一个特定的含义或功能。
虽然有许多不同的总线设计,但任何总线上的线都可以分成三个功能组:数据线、地址线和控制线。
此外可能还有为连接的模块提供电源的电源线。
数据线提供系统模块间传送数据的路径,这些线组合在一起称为数据总线。
典型的数据总线包含8、16或32根线,线的数量称为数据总线的宽度。
因为每条线每次传送1位,所以线的数目决定了每次能同时传送多少位。
数据总线的宽度是决定系统总体性能的关键因素。
地址线用于指定数据总线上数据的来源和去向。
例如,如果处理机希望从存储器中读一个字的数据,它将所需要字的地址放在地址线上。
显然,地址总线的宽度决定了系统最大可能的存储器容量。
控制线用来控制对数据线和地址线的访问和使用。
由于数据线和地址线被所有部件共享,因此必须用一种方法来控制它们的使用。
控制信号在系统模块之间传送命令和定时信息。
定时信息指定了数据和地址信息的有效性,命令信号指定了要执行的操作。
大多数计算机系统使用多总线,这些总线通常设计成层次结构。
图1.3显示了一个典型的高性能体系结构。
一条局部总线把处理机连接到高速缓存控制器,而高速缓存控制器又连接到支持主存储器的系统总线上。