📜 ⬆️ ⬇️

Instructor's Manual for the book “Programming: Principles and Practice Using C ++”

Hi, Habr! I present to your attention the translation of the article " Instructor's Guide for Programming " by author Bjarne Straustrup (last visited: 12/20/2017).


From translator


Bjarn Straustrup is known as the developer of the C ++ programming language. His books are on the tables of many venerable developers.


Of particular note is the textbook on the basics of programming "Programming: Principles and Practice Using C ++." Bjarn wrote it for students of the University of Texas Agriculture and Mechanical Engineering, in which he taught a course for students for a long time. In addition to the tutorial itself, the Instructor’s Manual can be found at www.stroustrup.com. The experience of teaching the course of the fundamentals of programming outlined in it can be useful not only for a course in C ++. The guide can find answers to typical questions of teachers: How to submit material? How to deal with a bundle of skills groups? How deep should you dive into the topic?


I did not manage to find the Russian version of the Instructor’s Handbook for the book Programming: Principles and Practice Using C ++, so I decided to translate it and publish it.


Summary


This text is simply a collection of observations and conclusions. They can be useful if you teach a course on the book Programming: Principles and Practice Using C ++.


Assumptions


I assume that you are a professor, a lecturer, an instructor, an assistant teacher. Maybe your post is called different. The main thing is that you study or plan to teach a course on the book "Programming: Principles and Practice Using C ++." I assume that you have read (at least) the preface of the book and Chapter 0 "Addressing the readers." If this is not the case, I ask you to devote some time to this before reading this material.


I assume that your students have not yet programmed, have a distant view of programming, or used a language that is different from C ++. I mainly solve the problems of the first two groups.


After general information about the chapter, you can find comments on individual sections. Use these notes when planning a lecture based on this chapter. Slides of my presentations are available on the site . If you use my material, I hope you will suggest how it can be improved.


We will be happy to receive feedback and a description of your teaching experience.


Note: This text is just notes and nothing more. No one has edited this text. Do not expect the completion of the material. On the contrary, it will be refined on the basis of further experience and as it is expressed in these records. I plan to update these notes (they are available on the support site).
Note Translation: Last updated 10/7/2011.


Introduction


There are persistent beliefs in the people that prevent us from learning how to write good programs:



Your main task as a programming teacher is to minimize the influence of these myths.


We have one successful practice. Every three or four lectures we devote a few minutes to the description of interesting applied problems solved by programming. In Chapter 1, you can get an idea of ​​what we find interesting. Students better perceive the dry theory, if they indicate the area of ​​its application. It is important that these comments are brief and do not become morals. If you yourself do not feel that some task is exciting, do not try to convince students of this. They will catch your false enthusiasm in the first moment. During the story, we rely on our personal experience, on what we saw on a business trip, heard on the news, or read in a magazine. Be sure to give examples: a couple of photos or even real devices, such as iPod, cell phone, clock.


Please note that students may have different interests. Some students may be interested in the latest developments in video games. However, such facts may create a negative notion of programming for more serious students who have not yet decided whether they need to study programming, computer science and information technology at all. The second group, in different proportions, may be interested in examples from biology and biomedicine. (Note: the textbook was developed at the University of Texas Agriculture and Mechanical Engineering, most likely this is a local specificity) It is very important to talk about the diversity of tasks, otherwise students will disconnect and maintain a narrow-minded, unimaginative look at programming. Whenever possible, try to link the code with an example from the real world: "Google uses techniques like in STL" is a good example for parts of STL, the iPod's graphic interface is suitable for the GUI chapter, and the airplane example is for chapters on working with hardware and correctness of the programs.


It is necessary to convey the idea that the writing and launching of small programs is part of the "reading chapter." We found that for many newbies, the material in the first chapters looks too simple to be taken seriously, and some of the pieces are too abstract to waste time on them. Students often come with little programming experience and therefore believe that they know everything. At least everything that they can tell at all in the first month. Because of this, they may even skip the first lectures. Others have not yet encountered programming, but believe that they can study it with the help of books. At school, they had the illusion that they themselves could distinguish the important from the non-essential. Some of the powerful students underestimate the time and effort they need to spend. School material was given to them without much effort. In reality, this is not the case. The sooner they understand this, the better.


To succeed in studying the course, the student first of all needs to “spend time” on the assignments. This is more important than previous programming experience, school grades, or intellectual abilities (as far as we can judge). For a minimum acquaintance with the material enough to complete the task. However, to complete the course you must attend lectures and perform exercises at the end of chapters. (Approx. Transl. At the end of each chapter of the book there are tasks and exercises) We allocate time in the "laboratory" and teacher assistants to help with the exercises. One of the useful practices is the division of students into small groups. In this case, it is desirable to make groups of people with diverse programming experience. In each chapter, make every effort to ensure that each student:



Beware geez know-alls who will convince other students that they are right, arguing with school knowledge or information from online forums. Using arrays and pointers instead of vectors and strings is a “brighter idea” that causes the most damage. Its victims are innocent novices who have to wade through the problems of buffer overflow, memory allocation with fixed blocks, the use of strcpy (), etc. long before they are ready for it.


It is believed that we write for "elite students of top universities". This is a very flattering review for TAMU freshmen, but the reality, as always, is not the same. We are not the most rigorous selection, and students are not as motivated to master the course as we would like. To be honest, the first few hundred students were electrical engineers and computer engineers who did not see their future in software development (the course itself was simply mandatory). We began to teach first-year students of the specialty of computer science much later, when our results reached the level of these specialists.


If you teach in a large group, not everyone will cope. In this case, you need to make a difficult decision: slow down to help weak students or keep up the pace and lose them. With every fiber of your soul, you would seek to slow down and help. Help. In all available ways. But in any case, do not slow down. It will be dishonest for smart, trained and hard-working students - from the lack of complex tasks they will get bored and you will lose them. If you lose someone anyway, let it be not your future stars, but those who will never become a good developer or scientist. Computer science and program development are inferior students to more interesting areas of science. Please do not aggravate this problem.


We are convinced that students will meet our expectations and our course seems to confirm this. Surveys show that students take up 25% more hours and speak about him 25% better than typical discipline for freshmen. Coincidentally, this was the highest satisfaction score in an engineering college). This course is no more difficult than the average biology, physics or mathematics for the first year for typical graduates of American schools. Usually in established academic areas of knowledge, such as biology, school preparation is better than computer science.


Some have suggested that the course was successful "because it was led by Bjarn Stroustrup." This is also very flattering, but also not true. First-year students are not in awe of someone's reputation, besides, many at first (to my regret) are much more interested in evaluations than in studying serious technical details. Anyway, the last 4 semesters of the course have been led by Pete Pietersen, Walter Doherty and Ronnie Ward; they are very experienced senior lecturers; I do only random guest lectures.


Initially, the course was conducted with two lectures per week plus classes in laboratories under the guidance of teaching assistants. This was not enough and we had to cut corners. Later, the course was extended to three lectures a week, plus labs, and better. Only then could we devote time to the analysis of examples and add more examples from the book. Most likely, it was not necessary for strong students (this information is in the book), but it helped most of the students. The book still has a lot of information that I would like to present at lectures. We set aside each slide for 2 minutes. If you have the same speed, you will find that some of the slides will have to be skipped in order to meet the lecture for 50 or 60 minutes. We do that too.


Now we decided to experiment and spread the course for two semesters with two lectures a week. I do not expect success, because it takes quite a lot of time between the beginning of the course and the beginning of the analysis of "interesting" tasks. Let's hope I'm wrong.


Further you will find reviews for each chapter. They may be useful to teachers, but I decided not to put them in a book. Quiz questions turned out to be more useful for students than reviews, which contain all the answers (and which they like for the wrong reason).


We always have time to go from chapter 1 to chapter 22 in a 15-week semester. This leaves us a few days to the session and time for the necessary group project in the last (approximately) three weeks (simultaneously with the final lectures). Chapters 22-27 don't really have to go in that order. You can read them if necessary. They can be very helpful in supporting more ambitious projects.


Please note that this means that we use the 1264-page book for the course, which is described on 812 pages. (approx. translation in the translation of 1329 pages of all and 827 on the main chapters). Everything else is an additional metaril: special topics for interested students, reference materials, etc.


Comment: Slides are a bit overloaded with information because some students (too) rely on the information in them and may miss the material in the book that is not on the slides. In addition, it helps the instructor, who had not enough time to prepare (a very common phenomenon). The code is written in 20pt. This is enough for the majority in an audience of 200 people. In rare exceptional cases, I use a font 18pt. I do not really like the decorations on the slides, so there are no tricky transitions or entertaining animation. If the dark background confuses you, change the design to black and white. Our team at TAMU never came to a common opinion on this. If you have more photographs for illustrations or they are of better quality, please send them to me. Students like beautiful photos if they are related to the topic of the lesson.


Before each chapter, review the error information (www.stroustrup.com/Programming/errata.html). Typos, especially in code snippets, can be very difficult to learn.


You can add slides to solve tactical issues. We do the same. I deleted all the slides related to TAMU so you don’t have to do that. Feel free to add your name on the first slide, but if you haven’t made any significant changes, please leave my name and a link to the support site. I publish PowerPoint in order to simplify the change.


Thanks


Thanks to Lawrence "Pete" Petersen, Walter Doherty and Ronnie Ward for the constructive comments on the slides and this guide.


Chapter 0: Appeal to readers


Obviously, "Chapter 0" is numbered strange. "0 is odd" simultaneously means "0 is odd" and "0 is strange". This is intentional absurdity. Only some students will read it, and most will miss it. Few of those who have never programmed before will be able to understand it. Its main goal is to give you, a professor, a lecturer, a teaching assistant, etc., a general idea of ​​my goals and methods.


So why the "Chapter 0"? Since the numbering in C ++ - like a scale on a roulette - starts from 0, not from 1. To give people a clue: "Something unusual is happening here." To indicate that this chapter is different from a series of other chapters with lectures and homework. To some extent, it conveys "meta-information."


We do not recommend students to read Chapter 0, however many will. We do not propose to hold lectures on the material of Chapter 0. At the same time, it contains ideas that should be used as needed in all lectures and discussions. She answers the questions "Why are we doing this?" and "Do we really need to do that?" long before the students set them up during the course. Sometimes it will be enough for you to answer "Now you are ready to read Chapter 0".


Nevertheless, I ask you to read Chapter 0 and take it seriously. At the initial stage, constant attempts to improve the course by adding material can have devastating consequences. Before Chapter 12, students are on the verge of overload. They move forward only if they are constantly motivated. After each chapter, they are able to do a little more than before, even if they do not understand it. Please do not try to extend the course, forcing students to understand absolutely everything at this stage. Your task is to prepare a base of skills for them to which they will be able to add new knowledge on their own and, at the same time, intelligently apply them.


If you are a teaching assistant, please read the entire book before attempting to explain anything to students. The stuff is different from your fathers C ++. In addition, open lectures, or at least read the text of the slides. It is difficult to help students if you do not know what facts they have. The information on the slides to the chapter is the best cheat sheet for the chapter itself.


In my opinion, one of the killer and destructive practices is a detailed study of the basic types of C ++, their interactions, as well as the detailed work of branching, cycles and recursion. At this stage, it's just dead weight. You have been an excellent developer for many years, but you cannot explain the (absurd) conversion rules from unsigned short to int .


Chapter 1 and 2


To start programming, a student needs to:


  1. The idea of ​​important and useful tasks for software developers, the desire to succeed in solving them, and a bit of idealism.
  2. An illustrative example that they can write, run and modify for the sake of experiment.
    Both are important. We propose to devote half of this to lecture 1.

The purpose of Chapter 1 is to convey a sense of excitement, desire for a noble goal and professionalism. She is not at all about how to create bloody and violent video games.


If you want to save the world (not as a politician, but as a technical specialist), then you will have to use a computer. The ideas, tools and techniques that are taught and studied here, are moving humanity forward. We are generally not against video games; we are against the common misconception that video games are the main use of computers. At every opportunity, casually mention that most video games are written in C ++ using techniques that you can learn in this course.


Many students can hardly imagine a computer that looks different than a PC with a keyboard and a screen. It is very useful to tell them about what the big half of computers are, what they are used for and what kind of people work with them. It doesn’t hurt to remind students that there are not enough good information systems builders in the industry (USA, Europe and other countries). And this means that they have a promising career and a good salary. The students themselves may not think about it for now, unlike their non-programmer friends and parents. Many people (popular journalists, career counselors and parents) remember the dot-com crisis in 2000 and may think that all the technical work was outsourced abroad. That this is not American businessmen who need qualified technical personnel. I can argue with them that most graduates of American colleges in electrical and computer specialties receive the highest average salary. More than specialists in pure science, business, etc.


Pay attention to the variety of platforms in the photos. Many students have a very vague idea of ​​what a computer is. A professional software developer during his career can meet a wide variety of platforms: from computers at the tip of the nail to monsters that fill entire halls or distributed on several continents.


Chapter 2 is about introducing the toolkit. In it, students will learn what to do to run the simplest program "Hello, world!". She is very uncomplicated. If you do not explain it unnecessarily confusingly (do not!), Then the typical reaction of the students is “What is the problem then?”. So far, there are no problems, and there will not be any if students master their tools and develop the habit of reading the text of assignments and doing the exercises.


Always look at the "Afterwords" section. It usually says something important, either about the chapter itself or about where it leads.


Lecture No. 1 reveals the content of both of these chapters and gives students an overview of the course so that they have an idea of ​​what they will come to in the end (in addition to the introductory discussion on the importance of software). Special attention is paid to the structure of the code and the fundamental desire for correctness and professionalism.


Clarifications to photos on slides are usually repeated in the book itself.
The aircraft depicted are Boeing 787 (C ++ systems contain systems that are not responsible for the flight) and F35 (single strike fighter) during the flight (over Fort Worth in Texas). Wind turbines are of course programmed in C ++. And that truck is used in seismic exploration of oil deposits. Many PCs operate the Keck Observatory, which is located on the peak of Mauna Kea, on the island of Hawaii.


Since we are dealing with newbies, then simply launching "Hello, world!" associated with many practical problems: Many students do not have accounts on the college server, some do not have C ++ compilers, and they don’t know where to get it, some teacher assistants have just returned from vacation or from a summer internship. Please do everything to solve administrative and logistical problems before the first lecture. If possible, hold a meeting with the teaching assistants a week before the start to determine how to minimize problems and how to solve them if they still occur (if you have 150 students, you will have unforeseen problems). Be available or (even better) ensure the availability of assistants between the first and second lecture so that everyone successfully runs the program "Hello, world!" before the start of lecture number 2. If this is not done, some students will lag behind the core group for weeks or even drop out.


Make sure all the assistants actually read each chapter before they start helping the students. Attracting assistants with knowledge of C ++ in a traditional course or even with knowledge of java is a bad idea.


In this lecture we also analyze what is deception and what is not. Many freshmen are a little confused by this. Joint study is considered a hoax? Is it forbidden to give someone to write off solved tasks? Is (library) library allowed? Our answers: "no", "yes", "only if you forget how it was done before." If ethics needs to be explained, this may be the right time for a story.


When enumerating the application areas of programming, I, like many others, overlook educational activities. If the student’s goal is to become a teacher (up to the university), especially a science teacher (again, up to the university), or someone is concerned with the spread of technical skills (trainers, technical lists, etc.), the base in software development can be not just useful, but necessary. Obviously, programming primarily inspires young people to take science and technology seriously: just think about robot competitions or visualization of biological systems.


In addition, I occasionally talk about the "industry" when I mean "software development for use in the real world." It is worth considering that the creation of real programs can also occur in universities, research laboratories, government and non-profit organizations.


Somewhere between the first three lectures, note that each of the examples can be run on any platform; mention PC on Windows, Apple, Linux and Unix. All code from the book can be found on the support site. We believe that portability is very important; most students either disagree with us or do not understand what they mean. However, many of them are tied to their current computer, and the course with the support of "portability" will be useful for them all. We allow students to use "any system with a modern C ++ compiler", while we provide direct support only to the system used at the university. Most students use Windows, but we always had several Mac and Linux users.


We use the self-made header file std_lib_facilities.h . This may not be the ideal approach, however:


  1. We avoided having to tell students about several header files ( \ <string> , \ <vector> and \ <algorithms> ) and related facts:
    • about namespaces ,
    • about the difference between custom types and built-in types,
    • about the correspondence between the header file and the tools that it connects
    • about the different ways of using the using directive and the possibility of explicitly specifying the namespace
  2. The file is written in accordance with the C ++ standard and will be parsed later.
    As a compromise, we decided to simplify the code for the first chapters by using std_lib_facilities.h . Chapter 8 contains a detailed description of header files and namespaces. A detailed explanation of the string , vector , iostream and algorithm will be even later.

We are very interested in not giving students just "magic". Nevertheless, the phrase "#include" std_lib_facilities.h "allows you to use the tools (facilities) of the standard library (and a little later we will explain how)" is much less like a spell than the "compiler produces executable code."


In addition to the book, you must have access to the support site , where you can download the std_lib_facilities.h header file. In case of lack of internet, I attached the contents of this file to the end of this document.


Different systems, IDEs, communities use different conventions about the location of header files and code files (.cpp). The structure of the project can confuse beginners (I myself sometimes get confused). The book is described in the assumption that .h and .cpp files are in the same folder. Thus, we include the header file with the directive


 #include "std_lib_facilities.h" 

Depending on the agreements, you can also advise students to use


 #include "../std_lib_facilities.h" //    

or


 #include "../../std_lib_facilities.h" //     

Or another option that complies with local agreements. You know better how to arrange it correctly in your surroundings. I can only guess.


Depending on where you got to std_lib_facilities.h , how you saved it, and also from your compiler, you can get the warning "newline missing at the end of file". In my opinion, this is a stupid warning. Add an empty line at the end of the file so that the compiler closes.


I use the .cpp extension for code files and .h for header files. There are also differing agreements on this. Quite often you can find the extension .cc for the code; in some places use .cxx and .C . And some monsieur (and their tools) prefer .hh or .H instead of .h . File extension is also a convention, not part of the language.


Of our students, 60% have already programmed, and 40% have not yet seen a single line of code. In the first weeks, we move quickly to level the students and quickly get down to material that is new to everyone. There are invariably students who previously programmed and show off at first; it may be scary for real newbies in programming. You need to convince both groups:


  1. What material can be learned without programming experience
  2. Sooner or later, even with programming experience, they will face something that was not in school. As they say, "welcome to the university."

Chapter 2 Afterword


  1. C ++ is a programming language for a wide range of software development tasks; Examples can be found on the page .
  2. A text surrounded by double quotes is considered a string literal in C ++.
  3. The expression \n is a "special character" denoting hyphenation to the next line.
  4. The name cout stands for standard output. Any text "sent to cout " will be displayed on the screen.
  5. In the source code, all text written after the // symbol is considered a comment. Comments are ignored by the compiler and written for those who will read and maintain the code.
  6. At the beginning of the program they usually write a comment explaining the purpose of the program. This type of comments reminds us (developers) of the idea that we need to formally, accurately and fully convey to the computer.
  7. The "#include" directive is needed by the computer to enable (make available) the facilities from the file.
  8. The std_lib_facilities.h file is important because it allows you to use the tools of the standard C ++ library.
  9. Each C ++ program must have an entry point — a function called main. The program starts with it.
  10. The part of a C ++ program that describes an action and is not a preprocessor directive is called a statement.
  11. The C ++ compiler translates the source code (which you write) from a human-readable form to a “machine code” that is executed by a computer.
  12. The compiler scans your source code for grammatical correctness. Each word must be defined. There should be no other obvious errors in the program that can be detected before launching the program. The compiler will only compile the program when all "compilation errors" are fixed.
  13. The compiler is probably your best friend during programming.
  14. A linker is a program that links together in the form of an executable program compiled parts of a program, often developed by different people.
  15. Object and executable files are not portable from system to system. For example, when you compile on a machine running Windows, you get an object file for Windows that does not run on a machine running Linux.
  16. If the compiler detects an error, it is called a compile-time error. If linker - linker error (link-time). Errors found after the launch can be either run-time errors or logical errors.
  17. As a rule, compile errors are easier to find and fix than linker errors. And linker errors are easier to find and fix than runtime errors and logical errors.
  18. The IDE or IDE tools help you write, debug, compile, build, and run your code.
  19. An IDE usually includes an editor with syntax highlighting. This feature helps you distinguish between comments, keywords and other parts of the code.
  20. You might get the impression that you understood everything you read and everything you heard from the instructor in class, but repetition and practice are necessary to develop programming skills.

Chapter 3 Objects, Types, and Values


At this stage, it is important to clarify that there is nothing fundamentally difficult in obtaining and maintaining value. However, this idea is new and unexpected for non-programmers, especially for non-programmers with a good knowledge of mathematics. The analogy works perfectly: a variable is a box in which you can put a value. In addition, we use an analogy: the type of a variable is the form of the box that determines what we can put in it.


It is critical that students complete assignments and several exercises. Students who have previously programmed tend to be too arrogant and miss some new facts (compared to school). We intentionally use the if construct before getting to know it in Chapter 4: note that this is just a new record of what they know from kindergarten. Approximately also point out that arithmetic operations are familiar to all from high school. Programming language tools are simply an unusual record of ideas that students already know. To point this out regularly is important. It is worth repeating it to students every time you disassemble another exemplary example.


Really new here is the assignment, initialization and types.


Note that for many (especially those who know mathematics well) the idea of ​​sequential execution of commands (by computer) will be unexpected. Take one or two slides and speak the program line by line “like a computer” for everyone to get a general idea. It does not take much time and will avoid problems in the future. You can take slides 20-21 ("assignment and increment"), as well as 27 ("another simple calculation"), especially if you have a risk to finish ahead of time. In Chapter 4 there will be a repetition.


Why load students with type safety issues at this stage? The goal is to start shaping a mindset that takes into account both technical limitations and real-world limitations: our language and our practices are simply ways of expressing the solution of a problem on hardware. Iron is real and can impose such restrictions, from which we can not completely abstract. This is a course of programming (software development), not mathematics and not philosophy.


Chapter 3 Afterword


  1. Real programs usually give results based on some source data. They do not display the same text each time they start.
  2. An object is a memory area with an indication of the type on which any information depends on the object.
  3. A variable is an object with the specified name and type (for example, int or string). It depends on the type that can be placed in the object. For example, sequences of characters can be placed in a variable of type string, and integers in int.
  4. The command after which the program allocates memory and can use a new name is called a definition.
  5. To read data from the user, use cin. The name is associated with the standard input stream (pronounced ce-in, from the English. "Character input"), described in the standard library.
  6. The compiler remembers the types of each variable and checks that you use them according to the type specified during the declaration.
  7. The expression cin >> name >> age; reads two values. The first will be placed in the name variable of the string type. The second is age of type int. Note that we can read multiple values ​​with a single input command. Similarly, we can output several values ​​in a single output command.
  8. Some operators can be seen in the table in section 2.4. (approx. transl. Probably referring to section 3.4)
  9. A string variable tracks the number of characters in it.
  10. If objects are used only according to the rules of their types, then the program, or program fragment, is type-safe.
  11. . , C++ , .
  12. !

4


, (if, while, for, switch) (" , ") — , .


( ).


. . . , "" , ( ). , . , . , 10 : — . . : " , , !". , , . : " " " ".


— . , , - . . . , , ( , , ).


, " " — . , , . .


++x ? ( ) ++x . x=x+1 "". , ++x . - for (int i=0; i<max; i=i+1) ... .


CS. , , . : " C++ , !". . " ". , , , . " ". , . , , (" ; ; — , !"). . , .


, , " ". , , "". . . "", .


, -. , .


4.


(. . )


  1. . ( 4.1)
  2. — . ( 4.1)
  3. , . ( 4.1)
  4. , . ( 4.1)
  5. : " , ". ( 4.3)
  6. . , . ( 4.3)
  7. . ( 4.3)
  8. . . ( 4.5)
  9. (block/compound statement) , . ( 4.5)
  10. . ( 4.5)
  11. , .. ; {} . ( 4.5)
  12. if-else . , , — . ( 4.6).
  13. , - , . ( 4.6)
  14. (switch) . ( 4.7.1)
  15. break; , break; . ( 4.7.1)
  16. default . . ( 4.7.1)
  17. , , . ( 4.8)
  18. for while, , . ( 4.8.3)
  19. for. (4.8.3)
  20. for . -. ( 4.8.3)
  21. while - , , , for. ( 4.8.3)
  22. , , . ( 4.2)
  23. " " , . ( 4.2)
  24. . , , . ( 4.9)
  25. , (). ( 4.9)
  26. . , , . ( 4.9.1)
  27. , . . ( 4.10)
  28. sort() : . ( 4.10.2)
  29. , . ( 4.11)

5:


, . , ( ) , .


" ". . .


, .


- - . , . , , .


5.


  1. , , . , , . ( 5.1)
  2. , , . ( 5.1)
  3. , , . , (. ) . ( 5.1)
  4. , , . ( 5.1)
  5. :
    • ( 5.1)
  6. , 90% . ( 5.1)
  7. :
    • ,
    • , ( 5.1)
  8. , , , , , , . ( 5.2)
  9. : "", . , , . ( 5.3.3)
    • , ,
    • . ( 5.5)
  10. C++ , " ", . , ( ) ( ) , . ( 5.6)
  11. . , . ( 5.6)
  12. , . , , . ( 5.7)
  13. , . , . ( 5.8.1)
  14. , : " error() exception& main() . ( 5.8.1)

6.


.
, .
. .
, , , . , — .


:


  1. , .
  2. ; ; , .

, , . " "; ; , . ( ) . , .


. .
(.. )


( ) , " " "" "". . . , 6 7. .


, — . , . . , . , ( ); , - . 8, .


. , :


  1. , ( ) .
    — .

, ", . ".
.


202-203. 4+5+6+7 , ( ).
4+5 6+7 . Token_stream , . , . , Token_stream . ( , " " , ).


, . , — . " ". — .. — . .


, . . , " , ..." .


, , , . .


6


  1. — . , ? ( 6.1)
  2. — , — . ( 6.2)
  3. — , . ( 6.2)
  4. , . , , . ( 6.2.2)
  5. . ( 6.3)
  6. " " . ( 6.3)
  7. , , . ( 6.3)
  8. : , . ( 6.4)
  9. Token C++. . ( 6.8)
  10. C++ : () . , , , .
  11. , — . .

7:


; , , .
— , ( , , ). : , , ..


, :


  1. Architect
  2. ( )
  3. ( )
  4. (maintainer)
  5. User

, .. " ".


, (" ") . .


7


  1. , . ( 7.1)
  2. , , , . ( 7.1)
  3. " ", !
  4. . -, . ( 7.1)
  5. , . . ( 7.3)
  6. . ( 7.4, 7.5)
  7. () , . , . ( 7.6)
  8. , . ( 7.6)
  9. . " " . ( 7.6.2)
  10. , . ( 7.6.2)
  11. , ; . ( 7.6.3)
  12. , . , . ( 7.6.4)
  13. , . . ( 7.6.4)
  14. . , . ( 7.7)

8. :


— . , . , !


. "" " " " ". , , ( ). , " " ( , " ").


, "" , — . " ", ( ) . . " " " /" . , , . , - "" 25 , . , 25 ( ), . , ( /, iostream). , (. ) (" , "). . , , , , : , .


: ( ). , . . ( ) .


8:


  1. , - . ( 8.1)
  2. C++ , C, Java C#, . ( 8.1)
  3. , , , , . ( 8.2)
  4. C++, , . ( 8.2)
  5. ; , . ( 8.2)
  6. , . ( 8.2)
  7. , ( ) , . ( 8.2)
  8. ; , . ( 8.2)
  9. extern . ( 8.2)
  10. , -. ( 8.2)
  11. ; const . ( 8.2.1)
  12. () . ( 8.2.1)
  13. C++ , , "- ". ( 8.3)
  14. std_lib_facilities.h , cout, vector, sqrt(), error(), . ( 8.3)
  15. . , . ( 8.4)
  16. — , - . ( 8.4)
  17. , . Do not complicate. ( 8.4)

9. :


" " ( ). . Date.


(9.4.3). , , , . .


, "" . . . , .. , " " . .


( ). — get() set() , , .


, , , " ".


. , , . " ".


9.


  1. , . ( 9.1)
  2. . C++ : . ( 9.1)
  3. , , .. , . ( 9.1)
  4. , , . ( 9.1)
  5. C++ ( ) , .
  6. , . public.
  7. , . ( 9.3)
  8. , -. ( 9.3)
  9. , . ( 9.4.3)
  10. , , . _ :: __. ( 9.4.4)
  11. - . — . , 5 , . ( 9.4.4)
  12. (enum) , . ( 9.5)
  13. , C++ , : +, -, *, /, %, [], (), ^, !, &, <, <=, > >=. ( 9.6)
  14. . ( 9.6)

10. /.


"" ( - ; ). — "". . . (, /, ), .


, :


  1. ( , )
  2. ( ) .
  3. ("" " ")

, , — GUI ( 12-16). : .


10.


  1. : , , .
  2. , . / . /. ( 10.1)
  3. /, , / . ( 10.1)
  4. - , , , , , . ( 10.1)
  5. , C++ istream, — ostream. ( 10.2)
  6. , " " — . , . ( 10.3)
  7. , , ( ), . ( 10.3)
  8. , , ( ) , . ( 10.3)
  9. ostream istream , . ( 10.4)
  10. . ! , istream , " ":
    • good() //
    • eof() // (" ")
    • fail() // -
    • bad() // - ( 10.6)
  11. , :
    • ( )
    • - ( 10.7)

11. /


"" . " , //_, ". , , , . ( ) // ( , , , , ). / .


" , ". . 23, , , . : " , 23; . , ".


11.


  1. , - iostreams, 10, . , . ( 11.1)
  2. , . , , . ( 11.1)
  3. , ostream, . , <<.
  4. << hex << oct . , << hex , , << oct — .
  5. , — 0, 0x ( 0X). C++.
  6. : oct, hex, dec, showbase, noshowbase setw.
  7. .
  8. : fixed, scientific, general ( standard), setprecision setw.
  9. general scientific fixed . - 6 .
  10. (general 6 ) , . " ".
  11. .
  12. , . : istream, , ostream — .
  13. . , , good().
  14. / , , / , , .
  15. , : .
  16. iostream , /, . , , / .
  17. istream, , istringstream, , — ostringstream.

12.


. - . . /, . , () , / — " ".


, () , .


( ) : (, ), . , "" .


, " " . , , , " ".


FLTK ( ) . /GUI, , . , , FLTK . , . Windows, Linux Mac, . " ; , ".


MSVS GUI. , FLTK , . , ( 180 ), — .


, " Next" , " ". , , , — 16.


( ) , . , , .. , " ".


, 12-16 "". "Next" "" . , , , .


, ( 17), " " . " " — .


13.


( ) , FLTK. ; . (14) : shape - , . , : ; "" . Lines Text .


new . Vector_ref , , , " new". - ( ), ", new Vector_ref ; 17. , ".


private (14).


, . , , .


14.


: , . , . , , . — — " ", . , " , " . , " ; "" " ". , , — , ; , ".


15.


. — 14, 15. , , "" ( " ", - — "", ).


(), . , , ( "" , ). , . exp(). . , . .


expN() . , ( ). , — , . , Function . , . Axis . , . . , " " . , .


"" , (, ( sleep(); , 26.6.1) ( 24.7)


16.


. GUI . iPod . , , " ".


, . , . , , : , , ..


17: .


" " . .


" ":



, "". . , , , " , ".


, std:vector ( 19). ( ) :



, , Java C# ( - — , ).


, . — ; . , - ( C C++). . 18 25, .


, — C++ ( ; . 19). .


18.


, , . C. , .


.


19. ,


reserve(), resize() push_back() ( ""). STL ( 20).


, : RAII . . . , ( , Java).


, "" , ( ). , . , - (. Microsoft C++). , . , , ( ) . .


20.


STL . , " " " " . STL , ( , . ). "" , .


, . "" , STL — , STL. , (accumulate() find()). .


: STL, . , , :



"". . . , — .


21.


. : "!". , ( : " !" — , " ?" — ). — , , . , — . ( , ).


22.


, , . . " ". , .


. . . , , .


- 5 , 80.


C++ . , , . Fortran/Cobol/Lisp , . C++/Java/PHP. , -.


. , .


23.


, , . . . , -, .


, -, -, -, -.


.


. , , ( A,C,G,T: , , , ).


: " C++". : C, C#, Javascript, Java, C++, Ruby, Python ..


( , ) . . , ( ), ( ) .


24.


Matrix, . ( ) - (generic) . ( ).


, . — . , ( ), . .


25.


, . , — . .


, , . . , ( ) . , 17-19 ( ) 24.


C. — , . — . ( C C++). ; ( " " " ").


TEA , , ( ) ( , ).


3 , . 4 F-16 , — , MAN. 1. : , () , — .


, / "", .


26.


, "" . , , , .. , — . , . , . . — . .


27. C


, C , C++. — C++ . — — . . C C++ (. ), "" " ". , "" — , C C++ - — ( ), .


, C , C++. C++. C :



, , C++ C, .


/ C C++. . , "" C.


. , . strcmp() C ( C++).


')

Source: https://habr.com/ru/post/349342/


All Articles